|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
这是代码- import urllib.request
- import re
- import os
- import random
- import time[img][/img]
- #url='http://www.umei.cc/meinvtupian/meinvxiezhen/198202.htm'
- headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'
- ,'referer':'https://www.mm131.net/xinggan/2330_3.html','accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'
- ,'authority':'www.mm131.net','path':'/xinggan/2330_4.html','accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'}
- #url='http://www.umei.cc/meinvtupian/meinvxiezhen/198202_3.htm'[float=left][/float]
- #for i in rang(2,10)
- os.chdir('img')
- for i in range(2,4):
- number=i
- url='https://www.mm131.net/xinggan/2330_'+str(number)+'.html'
- html=urllib.request.Request(url,None,headers)
- #html.add_header('user-agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36','referer','https://www.mm131.net/xinggan/2330_3.html')
- img_html=urllib.request.urlopen(html).read().decode(encoding='UTF-8',errors='ignore')
-
- p=r'src="(https://img1.mm131.me/pic/2330/.*\.jpg)'
- img_html1=re.findall(p,img_html)
- print(img_html1)
- for each in img_html1:
- print(each)
- file_name=each.split('/')[-1]
- urllib.request.urlretrieve(each.replace(' ','%20'),file_name)
复制代码
下载的图片 图片添加不了 是不是被反扒机制弄了,用python下载的图片都是一张二维码 |
|