1 from .common
import InfoExtractor
2 from ..utils
import remove_start
5 class PressTVIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://(?:www\.)?presstv\.ir/[^/]+/(?P<y>\d+)/(?P<m>\d+)/(?P<d>\d+)/(?P<id>\d+)/(?P<display_id>[^/]+)?'
9 'url': 'http://www.presstv.ir/Detail/2016/04/09/459911/Australian-sewerage-treatment-facility-/',
10 'md5': '5d7e3195a447cb13e9267e931d8dd5a5',
13 'display_id': 'Australian-sewerage-treatment-facility-',
15 'title': 'Organic mattresses used to clean waste water',
16 'upload_date': '20160409',
17 'thumbnail': r
're:^https?://.*\.jpg',
18 'description': 'md5:20002e654bbafb6908395a5c0cfcd125',
22 def _real_extract(self
, url
):
23 mobj
= self
._match
_valid
_url
(url
)
24 video_id
= mobj
.group('id')
25 display_id
= mobj
.group('display_id') or video_id
27 webpage
= self
._download
_webpage
(url
, display_id
)
29 # extract video URL from webpage
30 video_url
= self
._hidden
_inputs
(webpage
)['inpPlayback']
32 # build list of available formats
33 # specified in http://www.presstv.ir/Scripts/playback.js
34 base_url
= 'http://192.99.219.222:82/presstv'
43 'url': base_url
+ video_url
[:-4] + extension
,
44 'format_id': f
'{height}p',
46 } for height
, extension
in _formats
]
48 # extract video metadata
50 self
._html
_search
_meta
('title', webpage
, fatal
=True), 'PressTV-')
52 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
53 description
= self
._og
_search
_description
(webpage
)
55 upload_date
= '%04d%02d%02d' % (
63 'display_id': display_id
,
66 'thumbnail': thumbnail
,
67 'upload_date': upload_date
,
68 'description': description
,