数据爬取——拍信网美女图片

仅作练习使用,并无商业用途 

import requests
import json


headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36"
}
data = {
    "album_id": "191",
    "line": "1, 0, 0",
}
url_list = "https://api.paixin.com/copyright/in_album_list?limit=50&line=1,%200,%200"

res = requests.get(url=url_list, headers=headers, data=json.dumps(data)).json()
for i in res.get("data"):
    filename = i.get("media_data").get("title")
    filepath = requests.get(i.get("media_data").get("image2"))

    with open(f"{filename}.jpg", "wb") as mf:
        mf.write(filepath.content)
print("下载结束!")

 

你可能感兴趣的:(数据分析)