Apr-18-2021, 03:48 AM
First of all, I really don't know what the error is, so I can't come up with a better header.
I was learning scraping using Scrapy by following the tutorial on Scrapy's site. It worked fine following Scrapy's tutorial until I tried with another website that I was trying to scrape. I tried to use the Scrapy Shell with step by step coding and it worked as I wanted. The following gave me a blank file when I ran it and trying to store as a .json file [scrapy crawl -O xxx.json].
The data that I'm interested in: https://imgur.com/a/mz3bTnr time in the red box
Thank you very much!
I was learning scraping using Scrapy by following the tutorial on Scrapy's site. It worked fine following Scrapy's tutorial until I tried with another website that I was trying to scrape. I tried to use the Scrapy Shell with step by step coding and it worked as I wanted. The following gave me a blank file when I ran it and trying to store as a .json file [scrapy crawl -O xxx.json].
import scrapy from datetime import datetime class FinvizNewsSpider(scrapy.Spider): name = "finvizNews" start_urls = [ 'https://finviz.com/quote.ashx?t=ANPC' ] def parse(self, response): for news in response.css("tr"): yield { 'news_time' : datetime.strptime(news.css("td::text").get().replace('\xa0',''),'%b-%d-%y %I:%M%p')#, }Could you guys point out to me what's wrong with my code?
The data that I'm interested in: https://imgur.com/a/mz3bTnr time in the red box
Thank you very much!