43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
import aiohttp
|
|
|
|
base_url = "https://dm.video.qq.com/barrage/base/"
|
|
dm_url = "https://dm.video.qq.com/barrage/segment/p0047eb164c/t/v1/0/30000"
|
|
|
|
|
|
async def getTxVideoData(url, video_id):
|
|
url = "https://example.com/api/data.json" # 替换成你要请求的JSON数据的URL
|
|
json_data = await fetch_json(url)
|
|
if json_data:
|
|
# 在这里处理解析后的JSON数据
|
|
print(json_data)
|
|
|
|
async def fetch_json(url):
|
|
async with aiohttp.ClientSession() as session:
|
|
async with session.get(url) as response:
|
|
if response.status == 200:
|
|
data = await response.json()
|
|
return data
|
|
else:
|
|
print(f"Failed to fetch data. Status code: {response.status}")
|
|
return None
|
|
|
|
if __name__ == "__main__":
|
|
|
|
url = "https://v.qq.com/x/cover/mzc00200pppnnhl/p0047eb164c.html"
|
|
if "v.qq.com" in url:
|
|
# 调用 v.qq.com 对应的接口
|
|
await getTxVideoData(url, "p0047eb164c")
|
|
|
|
# 检查是否存在 "rainss.cn"
|
|
elif "rainss.cn" in url:
|
|
# 调用 rainss.cn 对应的接口
|
|
print("调用 rainss.cn 的接口")
|
|
|
|
# 检查是否存在 "allms.cn"
|
|
elif "allms.cn" in url:
|
|
# 调用 allms.cn 对应的接口
|
|
print("调用 allms.cn 的接口")
|
|
|
|
# 如果都不匹配
|
|
else:
|
|
print("未匹配到任何子字符串") |