[flickr] new site support

This commit is contained in:
Mort Yao 2015-10-12 20:59:43 +02:00
parent b16cd48610
commit 8fa57ef85b
4 changed files with 33 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Fork me on GitHub: <https://github.com/soimort/you-get>
### Supported Sites
* Dailymotion <http://dailymotion.com>
* Flickr <http://www.flickr.com>
* Freesound <http://www.freesound.org>
* Google+ <http://plus.google.com>
* Instagram <http://instagram.com>

View File

@ -991,6 +991,7 @@ def url_to_module(url):
douyutv,
ehow,
facebook,
flickr,
freesound,
funshion,
google,
@ -1071,6 +1072,7 @@ def url_to_module(url):
'douyutv': douyutv,
'ehow': ehow,
'facebook': facebook,
'flickr': flickr,
'freesound': freesound,
'fun': funshion,
'google': google,

View File

@ -15,6 +15,7 @@ from .douban import *
from .douyutv import *
from .ehow import *
from .facebook import *
from .flickr import *
from .freesound import *
from .funshion import *
from .google import *

View File

@ -0,0 +1,29 @@
#!/usr/bin/env python
__all__ = ['flickr_download']
from ..common import *
def flickr_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
html = get_html(url)
title = match1(html, r'<meta property="og:title" content="([^"]*)"')
photo_id = match1(html, r'"id":"([0-9]+)"')
html = get_html('https://secure.flickr.com/apps/video/video_mtl_xml.gne?photo_id=%s' % photo_id)
node_id = match1(html, r'<Item id="id">(.+)</Item>')
secret = match1(html, r'<Item id="photo_secret">(.+)</Item>')
html = get_html('https://secure.flickr.com/video_playlist.gne?node_id=%s&secret=%s' % (node_id, secret))
app = match1(html, r'APP="([^"]+)"')
fullpath = unescape_html(match1(html, r'FULLPATH="([^"]+)"'))
url = app + fullpath
mime, ext, size = url_info(url)
print_info(site_info, title, mime, size)
if not info_only:
download_urls([url], title, ext, size, output_dir, merge=merge, faker=True)
site_info = "Flickr.com"
download = flickr_download
download_playlist = playlist_not_supported('flickr')