]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ro220.py
d/control: Build-depend on flake8 and python3-nose.
[youtubedl] / youtube_dl / extractor / ro220.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..compat import compat_urllib_parse_unquote
5
6
7 class Ro220IE(InfoExtractor):
8 IE_NAME = '220.ro'
9 _VALID_URL = r'(?x)(?:https?://)?(?:www\.)?220\.ro/(?P<category>[^/]+)/(?P<shorttitle>[^/]+)/(?P<id>[^/]+)'
10 _TEST = {
11 'url': 'http://www.220.ro/sport/Luati-Le-Banii-Sez-4-Ep-1/LYV6doKo7f/',
12 'md5': '03af18b73a07b4088753930db7a34add',
13 'info_dict': {
14 'id': 'LYV6doKo7f',
15 'ext': 'mp4',
16 'title': 'Luati-le Banii sez 4 ep 1',
17 'description': r're:^Iata-ne reveniti dupa o binemeritata vacanta\. +Va astept si pe Facebook cu pareri si comentarii.$',
18 }
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23
24 webpage = self._download_webpage(url, video_id)
25 url = compat_urllib_parse_unquote(self._search_regex(
26 r'(?s)clip\s*:\s*{.*?url\s*:\s*\'([^\']+)\'', webpage, 'url'))
27 title = self._og_search_title(webpage)
28 description = self._og_search_description(webpage)
29 thumbnail = self._og_search_thumbnail(webpage)
30
31 formats = [{
32 'format_id': 'sd',
33 'url': url,
34 'ext': 'mp4',
35 }]
36
37 return {
38 'id': video_id,
39 'formats': formats,
40 'title': title,
41 'description': description,
42 'thumbnail': thumbnail,
43 }