]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/popcorntimes.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
11 from ..utils
import int_or_none
14 class PopcorntimesIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://popcorntimes\.tv/[^/]+/m/(?P<id>[^/]+)/(?P<display_id>[^/?#&]+)'
17 'url': 'https://popcorntimes.tv/de/m/A1XCFvz/haensel-und-gretel-opera-fantasy',
18 'md5': '93f210991ad94ba8c3485950a2453257',
21 'display_id': 'haensel-und-gretel-opera-fantasy',
23 'title': 'Hänsel und Gretel',
24 'description': 'md5:1b8146791726342e7b22ce8125cf6945',
25 'thumbnail': r
're:^https?://.*\.jpg$',
26 'creator': 'John Paul',
27 'release_date': '19541009',
35 def _real_extract(self
, url
):
36 mobj
= re
.match(self
._VALID
_URL
, url
)
37 video_id
, display_id
= mobj
.group('id', 'display_id')
39 webpage
= self
._download
_webpage
(url
, display_id
)
41 title
= self
._search
_regex
(
42 r
'<h1>([^<]+)', webpage
, 'title',
43 default
=None) or self
._html
_search
_meta
(
44 'ya:ovs:original_name', webpage
, 'title', fatal
=True)
46 loc
= self
._search
_regex
(
47 r
'PCTMLOC\s*=\s*(["\'])(?P
<value
>(?
:(?
!\
1).)+)\
1', webpage, 'loc
',
53 if ord('a
') <= c_ord <= ord('z
') or ord('A
') <= c_ord <= ord('Z
'):
54 upper = ord('Z
') if c_ord <= ord('Z
') else ord('z
')
58 loc_b64 += compat_chr(c_ord)
60 video_url = compat_b64decode(loc_b64).decode('utf
-8')
62 description = self._html_search_regex(
63 r'(?s
)<div
[^
>]+class=["\']pt-movie-desc[^>]+>(.+?)</div>', webpage,
64 'description', fatal=False)
66 thumbnail = self._search_regex(
67 r'<img[^>]+class=["\']video
-preview
[^
>]+\bsrc
=(["\'])(?P<value>(?:(?!\1).)+)\1',
68 webpage, 'thumbnail', default=None,
69 group='value') or self._og_search_thumbnail(webpage)
71 creator = self._html_search_meta(
72 'video:director', webpage, 'creator', default=None)
74 release_date = self._html_search_meta(
75 'video:release_date', webpage, default=None)
77 release_date = release_date.replace('-', '')
80 return int_or_none(self._html_search_meta(
81 name, webpage, default=None))
85 'display_id': display_id,
88 'description': description,
89 'thumbnail': thumbnail,
91 'release_date': release_date,
92 'duration': int_meta('video:duration'),
93 'tbr': int_meta('ya:ovs:bitrate'),
94 'width': int_meta('og:video:width'),
95 'height': int_meta('og:video:height'),