爬虫练习【三方Pixiv】

2021/10/2 6:11:39

本文主要是介绍爬虫练习【三方Pixiv】,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

网页链接
使用scrapy框架

class Huashi6Spider(scrapy.Spider):
    name = 'huashi6'
    allowed_domains = ['huashi6.com']
    mouth = 9

    base_url = 'https://rt.huashi6.com/front/works/rank_page?index={}&size=10&date=2021-{}-{}'
    start_urls = [f'https://rt.huashi6.com/front/works/rank_page?index={index}&size=10&date=2021-9-{day}' \
                  for day in range(1, 31)
                  for index in range(1, 6)]
    print(start_urls)

    def parse(self, response):
        # select = Selector(response)
        item = items.ChuzhanItem()
        print('HI')
        # f = open('pickLinks.txt', 'a')
        text = response.text
        list = re.findall('path":"(.*?)","width', text)

        for li in list:
            url = 'https://img2.huashi6.com/' + li
            item['url'] = url
            yield item

版权声明:仅作学习交流用途,侵权立删



这篇关于爬虫练习【三方Pixiv】的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程