1.效果如图所示
2.代码如下 注意替换自己的cookie
import requests
import json
import os
url = "https://www.douyin.com/aweme/v1/web/emoji/list?device_platform=webapp&aid=6383&channel=channel_pc_web&publish_video_strategy_type=2&pc_client_type=1&version_code=170400&version_name=17.4.0&cookie_enabled=true&screen_width=1920&screen_height=1080&browser_language=zh-CN&browser_platform=Win32&browser_name=Chrome&browser_version=102.0.0.0&browser_online=true&engine_name=Blink&engine_version=102.0.0.0&os_name=Windows&os_version=10&cpu_core_num=6&device_memory=8&platform=PC&downlink=10&effective_type=4g&round_trip_time=50&webid=7221167228921103884&msToken=PPXXCz5yzGWeqrCQKCZXYsXeP5oknLHD0fYHIDYWWCCPdQwyT6Eih7A2R5XU5bxiBjSIV2EMSkQ5uA_RilmHh5NJjk6DKgu3CT_TdiWiIkVCcbNUPANJndI=&X-Bogus=DFSzswVO2ZzANrGct72kfe9WX7nl"
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36",
"cookie": ""
}
rep = requests.get(url,headers=headers)
json_str = rep.text
data = json.loads(json_str)
path = "new_folder"
if os.path.exists(path):
os.remove(path)
os.makedirs(path)
i = 0
for item in data["emoji_list"]:
w1 = item["display_name"][1:-1]
print(item["display_name"][1:-1])
w2 = item["emoji_url"]["url_list"][0]
print(item["emoji_url"]["url_list"][0])
res = requests.get(w2)
file_path = os.path.join(path,str(i) + "." + w1 +".jpg")
with open(file_path, 'wb') as f:
f.write(res.content)
i = i + 1