python - How to scrape and extract similar xpaths onto different rows in csv using Scrapy -


I am facing a page that contains several H2 tags and I need all those titles That's stored in separate rows. My CSV sheet I am using scary for this and my current code is:

  items ["title"] = title. Selection ("// h2 / text ()"). Extract ()   

Obviously, it ends in a single cell in my CSV to store all the H2 tags on that page.

Is there any way by which I can break every H2 tag?

Thanks

You can loop on each h2 To set the "title" for each item, note the items starting with items

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -