]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/presstv.py
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..utils
import remove_start
9 class PressTVIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?presstv\.ir/[^/]+/(?P<y>\d+)/(?P<m>\d+)/(?P<d>\d+)/(?P<id>\d+)/(?P<display_id>[^/]+)?'
13 'url': 'http://www.presstv.ir/Detail/2016/04/09/459911/Australian-sewerage-treatment-facility-/',
14 'md5': '5d7e3195a447cb13e9267e931d8dd5a5',
17 'display_id': 'Australian-sewerage-treatment-facility-',
19 'title': 'Organic mattresses used to clean waste water',
20 'upload_date': '20160409',
21 'thumbnail': r
're:^https?://.*\.jpg',
22 'description': 'md5:20002e654bbafb6908395a5c0cfcd125'
26 def _real_extract(self
, url
):
27 mobj
= self
._match
_valid
_url
(url
)
28 video_id
= mobj
.group('id')
29 display_id
= mobj
.group('display_id') or video_id
31 webpage
= self
._download
_webpage
(url
, display_id
)
33 # extract video URL from webpage
34 video_url
= self
._hidden
_inputs
(webpage
)['inpPlayback']
36 # build list of available formats
37 # specified in http://www.presstv.ir/Scripts/playback.js
38 base_url
= 'http://192.99.219.222:82/presstv'
47 'url': base_url
+ video_url
[:-4] + extension
,
48 'format_id': '%dp' % height
,
50 } for height
, extension
in _formats
]
52 # extract video metadata
54 self
._html
_search
_meta
('title', webpage
, fatal
=True), 'PressTV-')
56 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
57 description
= self
._og
_search
_description
(webpage
)
59 upload_date
= '%04d%02d%02d' % (
67 'display_id': display_id
,
70 'thumbnail': thumbnail
,
71 'upload_date': upload_date
,
72 'description': description