|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
扒绝对领域妹子图
慢慢磨出来的0.0勿喷
- import requests
- import os
- from bs4 import BeautifulSoup
- def get_img(html):
- soup = BeautifulSoup(html,'html.parser')
- img_list = soup.find_all('img' , class_='dhpic wp-post-image')
- for s_img in img_list:
- img_url = s_img['src']
- img_name = img_url.split('/')[-1]
- img_content = requests.get(img_url).content
- with open('./img/'+img_name, 'wb') as wf:
- wf.write(img_content)
- def get_comments(url):
- headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36','referer': 'http://music.163.com/'}
- res = requests.get(url, headers=headers)
- return res
- def main():
- page = 4
- if os.path.exists('./img') == False:
- os.mkdir('./img')
- for each in range(1,page):
- url = 'https://girlph.com/jdly/page/' + str(each)
- res = get_comments(url)
- get_img(res.text)
- if __name__ == "__main__":
- main()
复制代码 |
|