Skip to content

Commit 92d0916

Browse files
committed
task 0013 added
1 parent 4cffdb4 commit 92d0916

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

agmcs/0013/0013.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#coding:utf-8
2+
import requests, re, os
3+
4+
url = 'http://tieba.baidu.com/p/2166231880'
5+
6+
header = {
7+
'Accept': '*/*',
8+
'Accept-Encoding':'gzip,deflate,sdch',
9+
'Accept-Language':'zh-CN,zh;q=0.8',
10+
'Connection':'keep-alive'
11+
}
12+
html = requests.get(url,headers = header)
13+
14+
data = html.content.decode('utf-8')
15+
find = re.compile(r'<img pic_type="0" class="BDE_Image" src="(.*?).jpg" bdwater')
16+
result = find.findall(data)
17+
18+
for img_url in result:
19+
name = img_url.split('/')[-1]
20+
img_url = img_url+'.jpg'
21+
html = requests.get(img_url,headers = header)
22+
im = html.content
23+
with open(name+'.jpg','wb')as f:
24+
f.write(im)

0 commit comments

Comments
 (0)