From 23ef209318097022b1e0616c58706eb2467b5163 Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Fri, 11 Jan 2013 19:58:56 +0100 Subject: [PATCH] YinYueTai: default to download the best quality; fix #63 --- you_get/downloader/yinyuetai.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/you_get/downloader/yinyuetai.py b/you_get/downloader/yinyuetai.py index 16f8178b..e243eb3f 100644 --- a/you_get/downloader/yinyuetai.py +++ b/you_get/downloader/yinyuetai.py @@ -7,10 +7,11 @@ from ..common import * def yinyuetai_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False): assert title html = get_html('http://www.yinyuetai.com/insite/get-video-info?flex=true&videoId=' + id) - #TODO: run a fully parse instead of text search - # url = r1(r'(http://flv.yinyuetai.com/uploads/videos/common/\w+\.flv\?t=[a-f0-9]{16})', html) - # url = r1(r'http://hc.yinyuetai.com/uploads/videos/common/[A-F0-9]{32}\.mp4\?v=\d{12}', html) - url = r1(r'(http://\w+\.yinyuetai\.com/uploads/videos/common/\w+\.(?:flv|mp4)\?(?:sc=[a-f0-9]{16}|v=\d{12}))', html) + + for quality in ['he\w*', 'hd\w*', 'hc\w*', '\w+']: + url = r1(r'(http://' + quality + '\.yinyuetai\.com/uploads/videos/common/\w+\.(?:flv|mp4)\?(?:sc=[a-f0-9]{16}|v=\d{12}))', html) + if url: + break assert url type, ext, size = url_info(url)