import re
import requests
def get_play_title_and_cid(url):
response = requests.get(url)
if response.status_code == 200:
pattern_title = r'"playTitle":"([^"]*)'
pattern_cid = r'"currentCid":"([^"]*)"'
match_title = re.search(pattern_title, response.text)
match_cid = re.search(pattern_cid, response.text)
if match_title and match_cid:
play_title = match_title.group(1)
current_cid = match_cid.group(1)
return play_title, current_cid
url = "https://v.qq.com/x/cover/mzc00200ccgo44c/e0046ckzhiw.html"
play_title, current_cid = get_play_title_and_cid(url)
if play_title and current_cid:
print("名称:", play_title)
print("分类地址:", current_cid)
else:
print("无法获取.")