]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/everyonesmixtape.py
493d38af8202ae02af1cb21d0b7edb5fd3a23c4c
1 from __future__
import unicode_literals
5 from . common
import InfoExtractor
12 class EveryonesMixtapeIE ( InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?everyonesmixtape\.com/#/mix/(?P<id>[0-9a-zA-Z]+)(?:/(?P<songnr>[0-9]))?$'
16 'url' : 'http://everyonesmixtape.com/#/mix/m7m0jJAbMQi/5' ,
20 "title" : "Passion Pit - \" Sleepyhead \" (Official Music Video)" ,
22 "uploader_id" : "frenchkissrecords" ,
23 "description" : "Music video for \" Sleepyhead \" from Passion Pit's debut EP Chunk Of Change. \n Buy on iTunes: https://itunes.apple.com/us/album/chunk-of-change-ep/id300087641 \n\n Directed by The Wilderness. \n\n http://www.passionpitmusic.com \n http://www.frenchkissrecords.com" ,
24 "upload_date" : "20081015"
27 'skip_download' : True , # This is simply YouTube
30 'url' : 'http://everyonesmixtape.com/#/mix/m7m0jJAbMQi' ,
38 def _real_extract ( self
, url
):
39 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
40 playlist_id
= mobj
. group ( 'id' )
42 pllist_url
= 'http://everyonesmixtape.com/mixtape.php?a=getMixes&u=-1&linked= %s &explore=' % playlist_id
43 pllist_req
= sanitized_Request ( pllist_url
)
44 pllist_req
. add_header ( 'X-Requested-With' , 'XMLHttpRequest' )
46 playlist_list
= self
._ download
_ json
(
47 pllist_req
, playlist_id
, note
= 'Downloading playlist metadata' )
49 playlist_no
= next ( playlist
[ 'id' ]
50 for playlist
in playlist_list
51 if playlist
[ 'code' ] == playlist_id
)
53 raise ExtractorError ( 'Playlist id not found' )
55 pl_url
= 'http://everyonesmixtape.com/mixtape.php?a=getMix&id= %s &userId=null&code=' % playlist_no
56 pl_req
= sanitized_Request ( pl_url
)
57 pl_req
. add_header ( 'X-Requested-With' , 'XMLHttpRequest' )
58 playlist
= self
._ download
_ json
(
59 pl_req
, playlist_id
, note
= 'Downloading playlist info' )
65 } for t
in playlist
[ 'tracks' ]]
67 if mobj
. group ( 'songnr' ):
68 songnr
= int ( mobj
. group ( 'songnr' )) - 1
69 return entries
[ songnr
]
71 playlist_title
= playlist
[ 'mixData' ][ 'name' ]
75 'title' : playlist_title
,