import requests
from bs4 import BeautifulSoup
url='https://www.manhuatai.com/yashe/?_t_t_t=0.09846753146736842'
r=requests.get(url)
r.raise_for_status()
r.encoding=r.apparent_encoding
txt=r.text
soup=BeautifulSoup(txt,'html.parser')
ls=[]
for item in soup.find_all('a'):
ls.append(item)
print(ls)
from bs4 import BeautifulSoup
url='https://www.manhuatai.com/yashe/?_t_t_t=0.09846753146736842'
r=requests.get(url)
r.raise_for_status()
r.encoding=r.apparent_encoding
txt=r.text
soup=BeautifulSoup(txt,'html.parser')
ls=[]
for item in soup.find_all('a'):
ls.append(item)
print(ls)
1.源代码奉上;
2.
由于漫客平台限制网络爬取功能,所以找的是漫画台版本,进行目录,以及部分章节图片的爬取。
import requests
import json
import urllib
def getSogouImag(category,length,path):
n = length
cate = category
imgs = requests.get('http://pic.sogou.com/pics/channel/getAllRecomPicByTag.jsp?category='+cate+'&tag=%E5%85%A8%E9%83%A8&start=0&len='+str(n))
jd = json.loads(imgs.text)
jd = jd['all_items']
imgs_url = []
for j in jd:
imgs_url.append(j['bthumbUrl'])
m = 0
for img_url in imgs_url:
print('***** '+str(m)+'.jpg *****'+' Downloading...')
urllib.request.urlretrieve(img_url,path+str(m)+'.jpg')
m = m + 1
print('Download complete!')
getSogouImag('壁纸',2000,'C:/User/每天无敌帅/Local/Programs/Magic/Magic(1)(1)/download/壁纸/')
准备爬图做壁纸,电脑就一个盘,苦的不行。。。结果图没扣下来,希望有大佬解惑。