Skip to content

Instantly share code, notes, and snippets.

@lxfly2000
Last active March 6, 2024 02:45
Show Gist options
  • Save lxfly2000/5d8ff1ac034e90c643a1d6213a5c7cc2 to your computer and use it in GitHub Desktop.
Save lxfly2000/5d8ff1ac034e90c643a1d6213a5c7cc2 to your computer and use it in GitHub Desktop.
获取缓存的QQ表情列表,URL,名字
#python 3.7.3
#encoding=utf-8
import os
import json
from urllib import request
em_url="https://imgcache.qq.com/qqshow/admindata/comdata/vipEmoji_item_%d/xydata.json"
br_url="https://gxh.vip.qq.com/club/themes/mobile/bq/html/detail.html?id=%d"
f=open("emlist.txt","w",encoding="utf-8")
em_dirs=[]
#对目录中所有文件夹
for em_dir in os.listdir():
if os.path.isdir(em_dir):
em_dirs.append(int(em_dir))
em_dirs.sort()
for id in em_dirs:
url=br_url%id
print(url,end=" ")
f.write(url)
data_req=request.urlopen(em_url%id)
name=json.loads(data_req.read())["appData"]["name"]
data_req.close()
print(name)
f.write(" "+name+"\n")
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment