[qq]new vid regex pattern

This commit is contained in:
MaxwellGoblin 2017-09-12 13:27:42 +08:00
parent abc34c2af1
commit 4c116c6f66

View File

@ -135,7 +135,7 @@ def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
else:
content = get_content(url)
vid = parse_qs(urlparse(url).query).get('vid') #for links specified vid like http://v.qq.com/cover/p/ps6mnfqyrfo7es3.html?vid=q0181hpdvo5
vid = vid[0] if vid else match1(content, r'vid"*\s*:\s*"\s*([^"]+)"') #general fallback
vid = vid[0] if vid else match1(content, r'v?id"*\s*:\s*"\s*([^"]+)"') #general fallback
title = match1(content,r'<a.*?id\s*=\s*"%s".*?title\s*=\s*"(.+?)".*?>'%vid)
title = match1(content, r'title">([^"]+)</p>') if not title else title
title = match1(content, r'"title":"([^"]+)"') if not title else title