]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/exfm.py
4 from .common
import InfoExtractor
7 class ExfmIE(InfoExtractor
):
10 _VALID_URL
= r
'(?:http://)?(?:www\.)?ex\.fm/song/([^/]+)'
11 _SOUNDCLOUD_URL
= r
'(?:http://)?(?:www\.)?api\.soundcloud.com/tracks/([^/]+)/stream'
14 u
'url': u
'http://ex.fm/song/1bgtzg',
15 u
'file': u
'95223130.mp3',
16 u
'md5': u
'8a7967a3fef10e59a1d6f86240fd41cf',
18 u
"title": u
"We Can't Stop - Miley Cyrus",
19 u
"uploader": u
"Miley Cyrus",
20 u
'upload_date': u
'20130603',
21 u
'description': u
'Download "We Can\'t Stop" \r\niTunes: http://smarturl.it/WeCantStop?IQid=SC\r\nAmazon: http://smarturl.it/WeCantStopAMZ?IQid=SC',
23 u
'note': u
'Soundcloud song',
26 u
'url': u
'http://ex.fm/song/wddt8',
27 u
'file': u
'wddt8.mp3',
28 u
'md5': u
'966bd70741ac5b8570d8e45bfaed3643',
30 u
'title': u
'Safe and Sound',
31 u
'uploader': u
'Capital Cities',
36 def _real_extract(self
, url
):
37 mobj
= re
.match(self
._VALID
_URL
, url
)
38 song_id
= mobj
.group(1)
39 info_url
= "http://ex.fm/api/v3/song/%s" %(song_id)
40 webpage
= self
._download
_webpage
(info_url
, song_id
)
41 info
= json
.loads(webpage
)
42 song_url
= info
['song']['url']
43 if re
.match(self
._SOUNDCLOUD
_URL
, song_url
) is not None:
44 self
.to_screen('Soundcloud song detected')
45 return self
.url_result(song_url
.replace('/stream',''), 'Soundcloud')
50 'title': info
['song']['title'],
51 'thumbnail': info
['song']['image']['large'],
52 'uploader': info
['song']['artist'],
53 'view_count': info
['song']['loved_count'],