原文链接

大兄弟你进来一定不是看我废话的吧,嗯,安排上,咱用图和爬虫说话,这些网站真的很不错!
emm…随便和想看详细解析的兄弟说一句,这里有个详细的样例,

1. hippopx

https://www.hippopx.com/
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图1
嘘~悄悄附上爬虫代码:

非高清:

  1. #这里以爬取小猫图片为例,倘若兄弟想爬取其他的,改一下参数就成噢
  2. from bs4 import BeautifulSoup
  3. import requests
  4. gHeads = {
  5. "User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36"
  6. }
  7. for i in range(1,65):
  8. url = "https://www.hippopx.com/zh/query?q=cat&page=%s"%(i) #q表示你要找到的名称,这里是catpage用来确定第几页
  9. print(url)
  10. html = requests.get(url,headers=gHeads)
  11. html = html.content
  12. soup = BeautifulSoup(html, 'lxml')
  13. img_all = soup.find_all('link',{"itemprop": "thumbnail"})
  14. for img4 in img_all:
  15. urlimg = img4['href']
  16. print(urlimg)
  17. r = requests.get(urlimg, stream=True)
  18. image_name = urlimg.split('/')[-1]
  19. with open('F:/Cat/%s' % image_name, 'wb') as f:
  20. for chunk in r.iter_content(chunk_size=128):
  21. f.write(chunk)
  22. print('Saved %s' % image_name)
  23. print("end.....................")

高清图片下载

  1. #Cat下载High-Definition
  2. from bs4 import BeautifulSoup
  3. import requests
  4. gHeads = {
  5. "User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36"
  6. }
  7. for i in range(2,100):
  8. url = "https://www.hippopx.com/zh/query?q=cat&page=%s"%(i)
  9. print(url)
  10. html = requests.get(url,headers=gHeads)
  11. html = html.content
  12. soup = BeautifulSoup(html, 'lxml')
  13. img_all = soup.find_all('img',{"itemprop": "contentUrl"})
  14. for img in img_all:
  15. urlimg = img['src']
  16. r = requests.get(urlimg, stream=True)
  17. image_name = urlimg.split('/')[-1]
  18. with open('F:/Cat_HighDefinition/%s' % image_name, 'wb') as f:
  19. for chunk in r.iter_content(chunk_size=128):
  20. f.write(chunk)
  21. print('Saved %s' % image_name)
  22. print("end.....................")


2. colorhub

https://www.colorhub.me/
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图2
非高清下载:

  1. from bs4 import BeautifulSoup
  2. import requests
  3. gHeads = {
  4. "User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36"
  5. }
  6. for i in range(1,10):
  7. url = "https://www.colorhub.me/search?tag=dog&page=%s"%(i)
  8. print(url)
  9. html = requests.get(url,headers=gHeads)
  10. html = html.content
  11. soup = BeautifulSoup(html, 'lxml')
  12. img_all = soup.find_all('img',{"class": "card-img-top"})
  13. for img4 in img_all:
  14. urlimg ="http:"+img4['src']
  15. r = requests.get(urlimg, stream=True)
  16. image_name = urlimg.split('/')[-1]
  17. with open('F:/Image_experiment/DOG/%s' % image_name, 'wb') as f:
  18. for chunk in r.iter_content(chunk_size=128):
  19. f.write(chunk)
  20. print('Saved %s' % image_name)
  21. print("end.....................")

高清下载:

  1. from bs4 import BeautifulSoup
  2. import requests
  3. import re
  4. gHeads = {
  5. "User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36"
  6. }
  7. for i in range(1,2):
  8. url = "https://www.colorhub.me/search?tag=dog&page=%s"%(i)
  9. print(url)
  10. html = requests.get(url,headers=gHeads)
  11. html = html.content
  12. soup = BeautifulSoup(html, 'lxml')
  13. href_all = soup.find_all('div',{"class":"card"})
  14. for href in href_all:
  15. href_url = href.a['href']
  16. html4 = requests.get(href_url,headers=gHeads).content
  17. soup4 = BeautifulSoup(html4, 'lxml')
  18. img4 = soup4.find('a',{"data-magnify":"gallery"})
  19. urlimg ="http:"+img4['href']
  20. r = requests.get(urlimg, stream=True)
  21. image_name = urlimg.split('/')[-1]
  22. with open('F:/Image/DOG/%s' % image_name, 'wb') as f:
  23. for chunk in r.iter_content(chunk_size=128):
  24. f.write(chunk)
  25. print('Saved %s' % image_name)
  26. print("end.....................")


3. pikrepo

https://www.pikrepo.com/
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图3
非高清下载:

  1. from bs4 import BeautifulSoup
  2. import requests
  3. gHeads = {
  4. "User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36"
  5. }
  6. for i in range(1,100):
  7. url = "https://www.pikrepo.com/search?q=mountain&page=%s"%(i)
  8. print(url)
  9. html = requests.get(url,headers=gHeads)
  10. html = html.content
  11. soup = BeautifulSoup(html, 'lxml')
  12. img_all = soup.find_all('img',{"itemprop": "thumbnail"})
  13. for img4 in img_all:
  14. urlimg = img4['data-src']
  15. r = requests.get(urlimg, stream=True)
  16. image_name = urlimg.split('/')[-1]
  17. with open('F:/Image_experiment/mountain/%s' % image_name, 'wb') as f:
  18. for chunk in r.iter_content(chunk_size=128):
  19. f.write(chunk)
  20. print('Saved %s' % image_name)
  21. print("end.....................")

高清下载:

  1. from bs4 import BeautifulSoup
  2. import requests
  3. gHeads = {
  4. "User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36"
  5. }
  6. for i in range(3,10):
  7. url = "https://www.pikrepo.com/search?q=mountain&page=%s"%(i)
  8. print(url)
  9. html = requests.get(url,headers=gHeads)
  10. html = html.content
  11. soup = BeautifulSoup(html, 'lxml')
  12. img_all = soup.find_all('link',{"itemprop": "contentUrl"})
  13. for img in img_all:
  14. urlimg = img['href']
  15. r = requests.get(urlimg, stream=True)
  16. image_name = urlimg.split('/')[-1]
  17. with open('F:/Image/Mountain/%s' % image_name, 'wb') as f:
  18. for chunk in r.iter_content(chunk_size=128):
  19. f.write(chunk)
  20. print('Saved %s' % image_name)
  21. print("end.....................")


4. wallhaven

https://wallhaven.cc/
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图4
非高清下载:

  1. from bs4 import BeautifulSoup
  2. import requests
  3. import re
  4. gHeads = {
  5. "User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36"
  6. }
  7. for i in range(1,200):
  8. url = "https://wallhaven.cc/search?q=FOG&page=%s"%(i)
  9. print(url)
  10. html = requests.get(url,headers=gHeads).content
  11. soup = BeautifulSoup(html, 'lxml')
  12. img_ul = soup.find_all("img",{"alt":"loading"})
  13. for img in img_ul:
  14. imgstr = str(img)
  15. url = img['data-src']
  16. r = requests.get(url, stream=True)
  17. image_name = url.split('/')[-1]
  18. with open('F:/Image_experiment/FOG/%s' % image_name, 'wb') as f:
  19. for chunk in r.iter_content(chunk_size=128):
  20. f.write(chunk)
  21. print('Saved %s' % image_name)
  22. print('end...........')

高清图片下载:

  1. from bs4 import BeautifulSoup
  2. import requests
  3. gHeads = {
  4. "User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36"
  5. }
  6. for i in range(1,20):
  7. url = "https://wallhaven.cc/search?q=DOG&page=%s"%(i)
  8. print(url)
  9. html = requests.get(url,headers=gHeads)
  10. html = html.content
  11. soup = BeautifulSoup(html, 'lxml')
  12. href_all = soup.find_all( 'a',{"class": "preview"})
  13. for href in href_all:
  14. href_url = href['href']
  15. html4 = requests.get(href_url,headers=gHeads).content
  16. soup4 = BeautifulSoup(html4, 'lxml')
  17. img4 = soup4.find( 'img',{"id": "wallpaper"})
  18. urlimg = img4['data-cfsrc']
  19. r = requests.get(urlimg, stream=True)
  20. image_name = urlimg.split('/')[-1]
  21. with open('F:/Image/DOG/%s' % image_name, 'wb') as f:
  22. for chunk in r.iter_content(chunk_size=128):
  23. f.write(chunk)
  24. print('Saved %s' % image_name)
  25. print("end.....................")

5. 还有这些不错的网站

5.1 pixabay

https://pixabay.com/images/search/sea/?pagi=2
图片高清且不涉及版权问题,哇,抱歉我的能力有限,不能近距离观赏啦(没爬成功,囧…),那…就远观吧
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图5

5.2 ssyer

https://www.ssyer.com/
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图6

5.3 不错的插画

https://mixkit.co/free-stock-art/discover/dog/
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图7

5.4 visualhunt

https://visualhunt.com/
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图8

5.5 pexels

https://www.pexels.com/zh-cn/search/DOG/
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图9

5.6 unsplash

https://unsplash.com/
赞!原来还有这些免费图片下载网站(内附部分爬虫代码) - 图10