]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/exfm.py
5 from .common
import InfoExtractor
8 class ExfmIE(InfoExtractor
):
9 _VALID_URL
= r
'(?:http://)?(?:www\.)?ex\.fm/song/([^/]+)'
10 _SOUNDCLOUD_URL_
= r
'(?:http://)?(?:www\.)?api\.soundcloud.com/tracks/([^/]+)/stream'
12 u
'url': u
'http://ex.fm/song/1bgtzg',
13 u
'file': u
'1bgtzg.mp3',
14 u
'md5': u
'8a7967a3fef10e59a1d6f86240fd41cf',
16 u
"title": u
"We Can't Stop",
17 u
"uploader": u
"Miley Cyrus",
18 u
'thumbnail': u
'http://i1.sndcdn.com/artworks-000049666230-w9i7ef-t500x500.jpg?9d68d37'
22 def _real_extract(self
, url
):
23 mobj
= re
.match(self
._VALID
_URL
, url
)
24 song_id
= mobj
.group(1)
25 info_url
= "http://ex.fm/api/v3/song/%s" %(song_id)
26 webpage
= self
._download
_webpage
(info_url
, song_id
)
27 info
= json
.loads(webpage
)
28 song_url
= re
.match(self
._SOUNDCLOUD
_URL
_,info
['song']['url'])
29 if song_url
is not None:
30 song_url
= song_url
.group() + "?client_id=b45b1aa10f1ac2941910a7f0d10f8e28"
32 song_url
= info
['song']['url']
37 'title': info
['song']['title'],
38 'thumbnail': info
['song']['image']['large'],
39 'uploader': info
['song']['artist'],
40 'view_count': info
['song']['loved_count'],