diff --git a/src/you_get/extractors/qq.py b/src/you_get/extractors/qq.py index eb188f98..0a007c0b 100644 --- a/src/you_get/extractors/qq.py +++ b/src/you_get/extractors/qq.py @@ -16,12 +16,17 @@ def qq_download_by_vid(vid, title, output_dir='.', merge=True, info_only=False): download_urls([url], title, ext, size, output_dir=output_dir, merge=merge) def qq_download(url, output_dir='.', merge=True, info_only=False, **kwargs): - content = get_html(url) - vid = match1(content, r'vid\s*:\s*"\s*([^"]+)"') - title = match1(content, r'title\s*:\s*"\s*([^"]+)"') - # try to get the right title for URLs like this: - # http://v.qq.com/cover/p/ps6mnfqyrfo7es3.html?vid=q0181hpdvo5 - title = matchall(content, [r'title\s*:\s*"\s*([^"]+)"'])[-1] + if 'iframe/player.html' in url: + vid = match1(url, r'\bvid=(\w+)') + # for embedded URLs; don't know what the title is + title = vid + else: + content = get_html(url) + vid = match1(content, r'vid\s*:\s*"\s*([^"]+)"') + title = match1(content, r'title\s*:\s*"\s*([^"]+)"') + # try to get the right title for URLs like this: + # http://v.qq.com/cover/p/ps6mnfqyrfo7es3.html?vid=q0181hpdvo5 + title = matchall(content, [r'title\s*:\s*"\s*([^"]+)"'])[-1] qq_download_by_vid(vid, title, output_dir, merge, info_only)