]>
Commit | Line | Data |
---|---|---|
5b66de88 JMS |
1 | import re |
2 | import base64 | |
3 | ||
4 | from .common import InfoExtractor | |
5 | ||
6 | ||
7 | class HotNewHipHopIE(InfoExtractor): | |
ed4a915e | 8 | _VALID_URL = r'http://www\.hotnewhiphop.com/.*\.(?P<id>.*)\.html' |
6f5ac90c | 9 | _TEST = { |
6523223a | 10 | u'url': u"http://www.hotnewhiphop.com/freddie-gibbs-lay-it-down-song.1435540.html", |
6f5ac90c PH |
11 | u'file': u'1435540.mp3', |
12 | u'md5': u'2c2cd2f76ef11a9b3b581e8b232f3d96', | |
13 | u'info_dict': { | |
bfb9f7bc | 14 | u"title": u'Freddie Gibbs "Lay It Down"' |
6f5ac90c PH |
15 | } |
16 | } | |
5b66de88 JMS |
17 | |
18 | def _real_extract(self, url): | |
19 | m = re.match(self._VALID_URL, url) | |
20 | video_id = m.group('id') | |
21 | ||
22 | webpage_src = self._download_webpage(url, video_id) | |
23 | ||
5b66de88 | 24 | video_url_base64 = self._search_regex(r'data-path="(.*?)"', |
ed54491c JMS |
25 | webpage_src, u'video URL', fatal=False) |
26 | ||
27 | if video_url_base64 == None: | |
28 | video_url = self._search_regex(r'"contentUrl" content="(.*?)"', webpage_src, | |
29 | u'video URL') | |
30 | return self.url_result(video_url, ie='Youtube') | |
5b66de88 | 31 | |
ed4a915e | 32 | video_url = base64.b64decode(video_url_base64).decode('utf-8') |
5b66de88 JMS |
33 | |
34 | video_title = self._html_search_regex(r"<title>(.*)</title>", | |
35 | webpage_src, u'title') | |
5b66de88 JMS |
36 | |
37 | results = [{ | |
38 | 'id': video_id, | |
39 | 'url' : video_url, | |
40 | 'title' : video_title, | |
46720279 | 41 | 'thumbnail' : self._og_search_thumbnail(webpage_src), |
5b66de88 JMS |
42 | 'ext' : 'mp3', |
43 | }] | |
46720279 | 44 | return results |