Skip to content

Commit

Permalink
Update spider_ForConvertToEXE.py
Browse files Browse the repository at this point in the history
  • Loading branch information
antares927 authored Feb 7, 2020
1 parent c3068f5 commit 8e472ff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spider_ForConvertToEXE.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ def read_pic_url(bs): # 读取当前页所有图片URL
def download_pic(urlgroup, path): # 下载图片
print("Download start")
pattern = re.compile(r"-(.*)")
opener = urllib.request.build_opener()
opener.addheaders = [('User-Agent',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36')]
urllib.request.install_opener(opener)
for url in urlgroup:
picname = re.findall(pattern, url)
print("Picture name:", picname)
Expand Down

0 comments on commit 8e472ff

Please sign in to comment.