]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/lnkgo.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class LnkGoIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?lnkgo\.alfa\.lt/visi-video/(?P<show>[^/]+)/ziurek-(?P<id>[A-Za-z0-9-]+)'
16 'url': 'http://lnkgo.alfa.lt/visi-video/yra-kaip-yra/ziurek-yra-kaip-yra-162',
20 'title': 'Yra kaip yra',
21 'upload_date': '20150107',
22 'description': 'md5:d82a5e36b775b7048617f263a0e3475e',
25 'thumbnail': r
're:^https?://.*\.jpg$'
28 'skip_download': True, # HLS download
31 'url': 'http://lnkgo.alfa.lt/visi-video/aktualai-pratesimas/ziurek-nerdas-taiso-kompiuteri-2',
35 'title': 'Nėrdas: Kompiuterio Valymas',
36 'upload_date': '20150113',
37 'description': 'md5:7352d113a242a808676ff17e69db6a69',
40 'thumbnail': r
're:^https?://.*\.jpg$'
43 'skip_download': True, # HLS download
52 def _real_extract(self
, url
):
53 display_id
= self
._match
_id
(url
)
55 webpage
= self
._download
_webpage
(
56 url
, display_id
, 'Downloading player webpage')
58 video_id
= self
._search
_regex
(
59 r
'data-ep="([^"]+)"', webpage
, 'video ID')
60 title
= self
._og
_search
_title
(webpage
)
61 description
= self
._og
_search
_description
(webpage
)
62 upload_date
= unified_strdate(self
._search
_regex
(
63 r
'class="[^"]*meta-item[^"]*air-time[^"]*">.*?<strong>([^<]+)</strong>', webpage
, 'upload date', fatal
=False))
65 thumbnail_w
= int_or_none(
66 self
._og
_search
_property
('image:width', webpage
, 'thumbnail width', fatal
=False))
67 thumbnail_h
= int_or_none(
68 self
._og
_search
_property
('image:height', webpage
, 'thumbnail height', fatal
=False))
70 'url': self
._og
_search
_thumbnail
(webpage
),
72 if thumbnail_w
and thumbnail_h
:
75 'height': thumbnail_h
,
78 config
= self
._parse
_json
(self
._search
_regex
(
79 r
'episodePlayer\((\{.*?\}),\s*\{', webpage
, 'sources'), video_id
)
81 if config
.get('pGeo'):
83 'This content might not be available in your country due to copyright reasons')
88 'url': config
['EpisodeVideoLink_HLS'],
91 m
= re
.search(r
'^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<play_path>.+)$', config
['EpisodeVideoLink'])
96 'url': m
.group('url'),
97 'play_path': m
.group('play_path'),
101 self
._sort
_formats
(formats
)
105 'display_id': display_id
,
108 'thumbnails': [thumbnail
],
109 'duration': int_or_none(config
.get('VideoTime')),
110 'description': description
,
111 'age_limit': self
._AGE
_LIMITS
.get(config
.get('PGRating'), 0),
112 'upload_date': upload_date
,