暴走漫画gif爬取及保存

xiaoxiao2021-02-28  7

#*config=utf-8*# #------------------------------ #暴走漫画的gif截图 #日期:2017.12.10 #语言:python3.6 #------------------------------ import requests from bs4 import BeautifulSoup import urllib.request import time from selenium import webdriver path=r'C:\Users\Administrator\Desktop\新建文件夹' #driver=webdriver.Firefox() url="http://baozoumanhua.com/catalogs/gif?page=" a=input("请输入页数:") time.sleep(2) url_1=url+str(a) headers={"User_Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0)" " Gecko/20100101 Firefox/58.0"} #driver.get(url_1) req=urllib.request.Request(url_1,headers=headers) html=urllib.request.urlopen(req).read() soup=BeautifulSoup(html,"html.parser") link=soup.find_all("video",attrs={'style':"width: 500px; height: 500px;"}) urllist=[video['poster']for video in link] titlelist=[video['loop']for video in link] for i in range(urllist.__len__()): imgurl=urllist[i] fliename=path+'\%s.gif' % time.time() urllib.request.urlretrieve(imgurl,fliename)
转载请注明原文地址: https://www.6miu.com/read-1400265.html

最新回复(0)