Skip to content

Commit 392b3bf

Browse files
committed
update
1 parent 4819c54 commit 392b3bf

File tree

252 files changed

+394
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+394
-194
lines changed

.idea/workspace.xml

Lines changed: 368 additions & 171 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

爬虫/Include/趣味学习图片下载/big_image_download.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def mkdir(path):
2626
# 如果目录存在则不创建,并提示目录已存在
2727
#print(path + ' 目录已存在')
2828
return False
29-
def downloadimage(imageid,imgname):
29+
def downloadimage(imageid,imgname):##下载大图和带水印的高质量大图
3030
url = 'https://weiliicimg9.pstatp.com/weili/l/'+str(imageid)+'.webp'
3131
url2 = 'https://icweiliimg9.pstatp.com/weili/l/'+str(imageid)+'.webp'
3232
b=False
@@ -40,10 +40,17 @@ def downloadimage(imageid,imgname):
4040
def getText(text,free):
4141
texturl = parse.quote(text)
4242
url="https://stock.tuchong.com/"+free+"search?term="+texturl+"&use=0"
43+
print(url)
4344
req=requests.get(url,headers=header)
4445
soup=BeautifulSoup(req.text,'lxml')
4546
js=soup.select('script')
46-
js=js[4]
47+
path=''
48+
if not free.__eq__(''):
49+
js=js[1]
50+
path='无水印/'
51+
else:
52+
js=js[3]
53+
path='图虫创意/'
4754
print(js)
4855
pattern = re.compile(r'window.hits = (\[)(.*)(\])')
4956
va = pattern.search(str(js)).group(2)#解析js内容
@@ -57,9 +64,9 @@ def getText(text,free):
5764
try:
5865
dict = json.loads(data)
5966
print(dict)
60-
imgname='img2/'+text+'/'+dict['title']+str(index)
67+
imgname='img2/'+path+text+'/'+dict['title']+str(index)
6168
index+=1
62-
mkdir('img2/'+text)
69+
mkdir('img2/'+path+text)
6370
imgid=dict['imageId']
6471
downloadimage(imgid,imgname)
6572
except Exception as e:
@@ -69,6 +76,6 @@ def getText(text,free):
6976
num=int(num)
7077
free=''
7178
if num==2:
72-
free='free'
79+
free='free/'
7380
text = input('输入关键词:')
7481
getText(text,free)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)