开发者

Recursive use of Scrapy to scrape webpages from a website

开发者 https://www.devze.com 2023-02-07 23:04 出处:网络
I have recently started to work with Scrapy. I am trying to gather some info from a large list which is divided into several pages(about 50). I can easily extract what I want from the first page inclu

I have recently started to work with Scrapy. I am trying to gather some info from a large list which is divided into several pages(about 50). I can easily extract what I want from the first page including the first page in the start_urls list. However I don't want to add all the links to these 50 pages to this l开发者_如何学Cist. I need a more dynamic way. Does anyone know how I can iteratively scrape web pages? Does anyone have any examples of this?

Thanks!


use urllib2 to download a page. Then use either re (regular expressions) or BeautifulSoup (an HTML parser) to find the link to the next page you need. Download that with urllib2. Rinse and repeat.

Scapy is great, but you dont need it to do what you're trying to do


Why don't you want to add all the links to 50 pages? Are the URLs of the pages consecutive like www.site.com/page=1, www.site.com/page=2 or are they all distinct? Can you show me the code that you have now?

0

精彩评论

暂无评论...
验证码 换一张
取 消