]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/newgrounds.py
2ef80bce02a8ec95e1a748cbcd27ee1631aeca59
4 from .common
import InfoExtractor
5 from ..utils
import determine_ext
8 class NewgroundsIE(InfoExtractor
):
9 _VALID_URL
= r
'(?:https?://)?(?:www\.)?newgrounds\.com/audio/listen/(?P<id>\d+)'
11 u
'url': u
'http://www.newgrounds.com/audio/listen/549479',
12 u
'file': u
'549479.mp3',
13 u
'md5': u
'fe6033d297591288fa1c1f780386f07a',
15 u
"title": u
"B7 - BusMode",
16 u
"uploader": u
"Burn7",
20 def _real_extract(self
, url
):
21 mobj
= re
.match(self
._VALID
_URL
, url
)
22 music_id
= mobj
.group('id')
23 webpage
= self
._download
_webpage
(url
, music_id
)
25 title
= self
._html
_search
_regex
(r
',"name":"([^"]+)",', webpage
, u
'music title')
26 uploader
= self
._html
_search
_regex
(r
',"artist":"([^"]+)",', webpage
, u
'music uploader')
28 music_url_json_string
= self
._html
_search
_regex
(r
'({"url":"[^"]+"),', webpage
, u
'music url') + '}'
29 music_url_json
= json
.loads(music_url_json_string
)
30 music_url
= music_url_json
['url']
37 'ext': determine_ext(music_url
),