tianyamingyue 发表于 2020-6-14 07:50:06

发错了求删帖

本帖最后由 tianyamingyue 于 2020-6-15 06:12 编辑

import requests
import re
import os

a='http://www.001photo.com/900/latest.asp'
header={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3314.0 Safari/537.36 SE 2.X MetaSr 1.0',
                     'Referer':'http://www.001photo.com/'}
b=requests.get(a,headers=header).content
c=b.decode('gb2312',errors = 'ignore')
d=set(re.findall(r'/900/photoshow.asp\?id=\d{6}',c))
print(d)
x=1
for e in d:
      f='http://www.001photo.com/'+e
      g=requests.get(f,headers=header).content
      h=g.decode('gb2312',errors='ignore')
      j=set(re.findall(r'/upload/img/small/2020/\d/\w*?-\d{12,13}-001photo.jpg',h))
      print(j)
      x+=1
      i=1
      for m in j:
            k=m.replace('small/','')
            z='http://www.001photo.com'+k
            y=requests.get(z).content
            filename='e:\ '+str(i)+'2020.6'+str(x)+'.jpg'
            with open(filename,'wb')as f:
                  f.write(y)
                  print('正在打印第'+str(x)+str(i)+'张照片')
                  i+=1

Mike_python小 发表于 2020-6-14 08:02:27

请使用代码格式发送! Please send in code format!

tianyamingyue 发表于 2020-6-14 08:02:57

求版主删帖,发错了,不知道怎么删。

liuzhengyuan 发表于 2020-6-14 08:51:14

tianyamingyue 发表于 2020-6-14 08:02
求版主删帖,发错了,不知道怎么删。

为啥要删帖呢?
(原帖子是可以直接编辑的,把标题改成“发错了,求版主删帖”,即可)
页: [1]
查看完整版本: 发错了求删帖