]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/newgrounds.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class NewgroundsIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?newgrounds\.com/(?:audio/listen|portal/view)/(?P<id>[0-9]+)'
12 'url': 'http://www.newgrounds.com/audio/listen/549479',
13 'md5': 'fe6033d297591288fa1c1f780386f07a',
17 'title': 'B7 - BusMode',
21 'url': 'http://www.newgrounds.com/portal/view/673111',
22 'md5': '3394735822aab2478c31b1004fe5e5bc',
27 'uploader': 'Squirrelman82',
31 def _real_extract(self
, url
):
32 mobj
= re
.match(self
._VALID
_URL
, url
)
33 music_id
= mobj
.group('id')
34 webpage
= self
._download
_webpage
(url
, music_id
)
36 title
= self
._html
_search
_regex
(
37 r
'<title>([^>]+)</title>', webpage
, 'title')
39 uploader
= self
._html
_search
_regex
(
40 [r
',"artist":"([^"]+)",', r
'[\'"]owner[\'"]\s
*:\s
*[\'"]([^\'"]+)[\'"],'],
43 music_url_json_string = self._html_search_regex(
44 r'({"url":"[^"]+"),', webpage, 'music url') + '}'
45 music_url_json = json.loads(music_url_json_string)
46 music_url = music_url_json['url']