From 71ec9cad223f4ee2022d2530c2bc5154213907ef Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Fri, 27 May 2016 03:12:49 +0200 Subject: [PATCH] [videomega] support embedded URLs --- src/you_get/extractors/videomega.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/you_get/extractors/videomega.py b/src/you_get/extractors/videomega.py index a2965e7a..34fb5205 100644 --- a/src/you_get/extractors/videomega.py +++ b/src/you_get/extractors/videomega.py @@ -15,11 +15,14 @@ def videomega_download(url, output_dir='.', merge=True, info_only=False, **kwarg ('Cookie', 'noadvtday=0')] request.install_opener(opener) - content = get_content(url) - m = re.search(r'ref="([^"]*)";\s*width="([^"]*)";\s*height="([^"]*)"', content) - ref = m.group(1) - width, height = m.group(2), m.group(3) - php_url = 'http://videomega.tv/view.php?ref=%s&width=%s&height=%s' % (ref, width, height) + if re.search(r'view\.php', url): + php_url = url + else: + content = get_content(url) + m = re.search(r'ref="([^"]*)";\s*width="([^"]*)";\s*height="([^"]*)"', content) + ref = m.group(1) + width, height = m.group(2), m.group(3) + php_url = 'http://videomega.tv/view.php?ref=%s&width=%s&height=%s' % (ref, width, height) content = get_content(php_url) title = match1(content, r'(.*)')