]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/hotnewhiphop.py
4 from .common
import InfoExtractor
7 class HotNewHipHopIE(InfoExtractor
):
8 _VALID_URL
= r
'http://www\.hotnewhiphop.com/.*\.(?P<id>.*)\.html'
10 u
'url': u
"http://www.hotnewhiphop.com/freddie-gibbs-lay-it-down-song.1435540.html'",
11 u
'file': u
'1435540.mp3',
12 u
'md5': u
'2c2cd2f76ef11a9b3b581e8b232f3d96',
14 u
"title": u
"Freddie Gibbs Songs - Lay It Down"
18 def _real_extract(self
, url
):
19 m
= re
.match(self
._VALID
_URL
, url
)
20 video_id
= m
.group('id')
22 webpage_src
= self
._download
_webpage
(url
, video_id
)
24 video_url_base64
= self
._search
_regex
(r
'data-path="(.*?)"',
25 webpage_src
, u
'video URL', fatal
=False)
27 if video_url_base64
== None:
28 video_url
= self
._search
_regex
(r
'"contentUrl" content="(.*?)"', webpage_src
,
30 return self
.url_result(video_url
, ie
='Youtube')
32 video_url
= base64
.b64decode(video_url_base64
).decode('utf-8')
34 video_title
= self
._html
_search
_regex
(r
"<title>(.*)</title>",
35 webpage_src
, u
'title')
40 'title' : video_title
,
41 'thumbnail' : self
._og
_search
_thumbnail
(webpage_src
),