Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Python scraper for facebook marketplace isn't working anymore

$
0
0

Since yesterday, I encountered an issue where my facebook marketplace scraper ceased to fetch data, I'm currently using scrapy due to his features, am I doing any mistakes? Output has been shared on my gist

Current code below

from scrapy import Spiderimport loggingclass Facebook(Spider):    name = 'facebook'    start_urls = ["https://www.facebook.com/marketplace/112047398814697/search?query=funko&sortBy=creation_time_descend&radius=500"]    def parse(self, response):        from pdb import set_trace; set_trace()        # get all HTML product elements        products = response.xpath('//div[@style="max-width:1872px"]/div[2]/div')        # iterate over the list of products        for product in products:           # return a generator for the scraped item            yield {"name": product.css("h2::text").get(),"image": product.css("img").attrib["src"],"price": product.css('span::text').getall()[2],"url": product.css("a").attrib["href"],            }

I've already tested with selenium and requests-html, but they don't works like expected.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>