diff options
author | Naglis Jonaitis <njonaitis@gmail.com> | 2014-10-30 01:42:52 +0200 |
---|---|---|
committer | Naglis Jonaitis <njonaitis@gmail.com> | 2014-10-30 01:42:52 +0200 |
commit | b8a618f898b42e317b2abb13e33f60641d75a762 (patch) | |
tree | 79f313bc0e00287cd35e20f6772b9e6854890b4a | |
parent | feb74960eb0be0ee832ce5b07b1e1533eca518f9 (diff) |
[ro220] Fix broken extractor and modernize (#4054)
-rw-r--r-- | youtube_dl/extractor/ro220.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/youtube_dl/extractor/ro220.py b/youtube_dl/extractor/ro220.py index a6ad59465..0a3a71448 100644 --- a/youtube_dl/extractor/ro220.py +++ b/youtube_dl/extractor/ro220.py @@ -1,43 +1,43 @@ from __future__ import unicode_literals -import re - from .common import InfoExtractor -from ..utils import ( - clean_html, - compat_parse_qs, -) +from ..utils import compat_urllib_parse_unquote class Ro220IE(InfoExtractor): IE_NAME = '220.ro' - _VALID_URL = r'(?x)(?:https?://)?(?:www\.)?220\.ro/(?P<category>[^/]+)/(?P<shorttitle>[^/]+)/(?P<video_id>[^/]+)' + _VALID_URL = r'(?x)(?:https?://)?(?:www\.)?220\.ro/(?P<category>[^/]+)/(?P<shorttitle>[^/]+)/(?P<id>[^/]+)' _TEST = { - "url": "http://www.220.ro/sport/Luati-Le-Banii-Sez-4-Ep-1/LYV6doKo7f/", - 'file': 'LYV6doKo7f.mp4', + 'url': 'http://www.220.ro/sport/Luati-Le-Banii-Sez-4-Ep-1/LYV6doKo7f/', 'md5': '03af18b73a07b4088753930db7a34add', 'info_dict': { - "title": "Luati-le Banii sez 4 ep 1", - "description": "re:^Iata-ne reveniti dupa o binemeritata vacanta\. +Va astept si pe Facebook cu pareri si comentarii.$", + 'id': 'LYV6doKo7f', + 'ext': 'mp4', + 'title': 'Luati-le Banii sez 4 ep 1', + 'description': 're:^Iata-ne reveniti dupa o binemeritata vacanta\. +Va astept si pe Facebook cu pareri si comentarii.$', } } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('video_id') + video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - flashVars_str = self._search_regex( - r'<param name="flashVars" value="([^"]+)"', - webpage, 'flashVars') - flashVars = compat_parse_qs(flashVars_str) + url = compat_urllib_parse_unquote(self._search_regex( + r'(?s)clip\s*:\s*{.*?url\s*:\s*\'([^\']+)\'', webpage, 'url')) + title = self._og_search_title(webpage) + description = self._og_search_description(webpage) + thumbnail = self._og_search_thumbnail(webpage) + + formats = [{ + 'format_id': 'sd', + 'url': url, + 'ext': 'mp4', + }] return { - '_type': 'video', 'id': video_id, - 'ext': 'mp4', - 'url': flashVars['videoURL'][0], - 'title': flashVars['title'][0], - 'description': clean_html(flashVars['desc'][0]), - 'thumbnail': flashVars['preview'][0], + 'formats': formats, + 'title': title, + 'description': description, + 'thumbnail': thumbnail, } |