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