]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/exfm.py
09ed4f2b5644c5c8d55ea944d98e1684acacc125
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
8 class ExfmIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?ex\.fm/song/(?P<id>[^/]+)'
12 _SOUNDCLOUD_URL
= r
'http://(?:www\.)?api\.soundcloud\.com/tracks/([^/]+)/stream'
15 'url': 'http://ex.fm/song/eh359',
16 'md5': 'e45513df5631e6d760970b14cc0c11e7',
20 'title': 'Test House "Love Is Not Enough" (Extended Mix) DeadJournalist Exclusive',
21 'uploader': 'deadjournalist',
22 'upload_date': '20120424',
23 'description': 'Test House \"Love Is Not Enough\" (Extended Mix) DeadJournalist Exclusive',
25 'note': 'Soundcloud song',
26 'skip': 'The site is down too often',
29 'url': 'http://ex.fm/song/wddt8',
30 'md5': '966bd70741ac5b8570d8e45bfaed3643',
34 'title': 'Safe and Sound',
35 'uploader': 'Capital Cities',
37 'skip': 'The site is down too often',
41 def _real_extract(self
, url
):
42 mobj
= re
.match(self
._VALID
_URL
, url
)
43 song_id
= mobj
.group('id')
44 info_url
= 'http://ex.fm/api/v3/song/%s' % song_id
45 info
= self
._download
_json
(info_url
, song_id
)['song']
46 song_url
= info
['url']
47 if re
.match(self
._SOUNDCLOUD
_URL
, song_url
) is not None:
48 self
.to_screen('Soundcloud song detected')
49 return self
.url_result(song_url
.replace('/stream', ''), 'Soundcloud')
54 'title': info
['title'],
55 'thumbnail': info
['image']['large'],
56 'uploader': info
['artist'],
57 'view_count': info
['loved_count'],