]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/flickr.py
0c858b6544b919b1b569b4c4102447631298046e
1 from __future__
import unicode_literals
5 from . common
import InfoExtractor
12 class FlickrIE ( InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.|secure\.)?flickr\.com/photos/(?P<uploader_id>[\w\-_@]+)/(?P<id>\d+).*'
15 'url' : 'http://www.flickr.com/photos/forestwander-nature-pictures/5645318632/in/photostream/' ,
16 'md5' : '6fdc01adbc89d72fc9c4f15b4a4ba87b' ,
20 "description" : "Waterfalls in the Springtime at Dark Hollow Waterfalls. These are located just off of Skyline Drive in Virginia. They are only about 6/10 of a mile hike but it is a pretty steep hill and a good climb back up." ,
21 "uploader_id" : "forestwander-nature-pictures" ,
22 "title" : "Dark Hollow Waterfalls"
26 def _real_extract ( self
, url
):
27 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
29 video_id
= mobj
. group ( 'id' )
30 video_uploader_id
= mobj
. group ( 'uploader_id' )
31 webpage_url
= 'http://www.flickr.com/photos/' + video_uploader_id
+ '/' + video_id
32 webpage
= self
._ download
_ webpage
( webpage_url
, video_id
)
34 secret
= self
._ search
_ regex
( r
"photo_secret: '(\w+)'" , webpage
, 'secret' )
36 first_url
= 'https://secure.flickr.com/apps/video/video_mtl_xml.gne?v=x&photo_id=' + video_id
+ '&secret=' + secret
+ '&bitrate=700&target=_self'
37 first_xml
= self
._ download
_ webpage
( first_url
, video_id
, 'Downloading first data webpage' )
39 node_id
= self
._ html
_ search
_ regex
( r
'<Item id="id">(\d+-\d+)</Item>' ,
42 second_url
= 'https://secure.flickr.com/video_playlist.gne?node_id=' + node_id
+ '&tech=flash&mode=playlist&bitrate=700&secret=' + secret
+ '&rd=video.yahoo.com&noad=1'
43 second_xml
= self
._ download
_ webpage
( second_url
, video_id
, 'Downloading second data webpage' )
45 self
. report_extraction ( video_id
)
47 mobj
= re
. search ( r
'<STREAM APP="(.+?)" FULLPATH="(.+?)"' , second_xml
)
49 raise ExtractorError ( 'Unable to extract video url' )
50 video_url
= mobj
. group ( 1 ) + unescapeHTML ( mobj
. group ( 2 ))
56 'title' : self
._ og
_ search
_ title
( webpage
),
57 'description' : self
._ og
_ search
_ description
( webpage
),
58 'thumbnail' : self
._ og
_ search
_ thumbnail
( webpage
),
59 'uploader_id' : video_uploader_id
,