Google+: default to download the best quality & codecs; fix #42 and #43

This commit is contained in:
Mort Yao 2012-12-17 03:20:19 +01:00
parent 9028df6e39
commit a681458860
3 changed files with 40 additions and 6 deletions

View File

@ -1,6 +1,15 @@
Changelog
=========
0.3dev-20121217
---------------
*Date: 2012-12-17*
* Google+: downloading the highest available quality now.
* Fix issues `#42 <https://github.com/soimort/you-get/issues/42>`_, `#43 <https://github.com/soimort/you-get/issues/43>`_ for Google+.
* Merge pull request `#40 <https://github.com/soimort/you-get/pull/40>`_; fix some issues for Ku6, Sina and 56.
0.3dev-20121212
---------------

View File

@ -4,9 +4,11 @@ __all__ = ['googleplus_download']
from ..common import *
import re
def googleplus_download(url, output_dir = '.', merge = True, info_only = False):
# Percent-encoding Unicode URL
url = parse.quote(url, safe = ':/')
url = parse.quote(url, safe = ':/+%')
html = get_html(url)
html = parse.unquote(html).replace('\/', '/')
@ -14,10 +16,33 @@ def googleplus_download(url, output_dir = '.', merge = True, info_only = False):
title = r1(r'<title>(.*)</title>', html) or r1(r'<title>(.*)\n', html)
url2 = r1(r'"(https\://plus\.google\.com/photos/.*?)",,"image/jpeg","video"\]', html)
html2 = get_html(url2)
html2 = parse.unquote(html2.replace('\/', '/'))
if url2:
html = get_html(url2)
html = parse.unquote(html.replace('\/', '/'))
real_url = r1(r',\"(http://redirector.googlevideo.com/.*)\"]', html2)
url_data = re.findall(r'(\[[^\[\"]+\"http://redirector.googlevideo.com/.*\"\])', html)
for itag in [
'38',
'46', '37',
'102', '45', '22',
'84',
'120',
'85',
'44', '35',
'101', '100', '43', '34', '82', '18',
'6',
'83', '5', '36',
'17',
'13',
]:
real_url = None
for url_item in url_data:
if itag == str(eval(url_item)[0]):
real_url = eval(url_item)[3]
break
if real_url:
break
real_url = unicodize(real_url)
type, ext, size = url_info(real_url)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
__version__ = '0.3dev-20121212'
__date__ = '2012-12-12'
__version__ = '0.3dev-20121217'
__date__ = '2012-12-17'