python 4k写真沉浸式欣赏下载

python 4k写真沉浸式欣赏下载
import requests
import parsel
import os  #1069  2145
url='https://www.yituyu.com/gallery/1069/'
headers={'user-agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' }
try:
        path=os.getcwd()
        file_path=path+'\\'+'4k写真'
        os.mkdir(file_path)
except:
        pass
x=1069
while(x<2146):
    y=1
    urls='https://www.yituyu.com/gallery/'+str(x)+'/'
    FIRst=requests.get(urls,headers).text
    selector=parsel.Selector(FIRst)
    url=selector.xpath('//div[@class="gallerypic"]/img/@data-src').getall()
    name=selector.xpath('//div[@class="gallerypic"]/img[1]/@alt').get()
    for i in url:
        LASt=requests.get(i,headers).content
        with open(f'{file_path}\\{name}'+str(y)+'.jpg','wb')as f: 
            f.write(LASt)
            print('正在写入:'+name)
            y+=1
        x+=1
声明:本站大部分下载资源收集于网络,只做学习和交流使用,版权归原作者所有,未及时购买和付费发生的侵权行为,与本站无关。

给TA打赏
共{{data.count}}人
人已打赏
Linux运维开发编程

上海疫情买菜抢菜的临时解决方案

2022-4-11 11:29:14

Linux运维开发编程

python爬虫微博用户的所有微博存下来防止和谐

2022-4-14 11:31:04

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索