import json
import requests
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537",
"Accept": "application/json",
}
if __name__ == '__main__':
# 随机一张
url = 'https:///v3/Delivery/Placement?pid=209567&fmt=json&cdm=1&pl=zh-CN&lc=zh-CN&ctry=CN'
content = requests.get(url, headers=headers)
data = json.loads(content.text)
img_url = json.loads(data.get('batchrsp').get('items')[0].get('item')).get('ad').get('image_fullscreen_001_landscape').get('u')
res = requests.get(img_url)
with open('123.png', 'wb') as f:
f.write(res.content)
# 每日固定一张
url =
content = requests.get(url, headers=headers)
data = json.loads(content.text)
print(data)
image_url = '
print(image_url)
res = requests.get(image_url)
with open('234.png', 'wb') as f:
f.write(res.content)