YouTube: regex enhanced; fix #45

This commit is contained in:
Mort Yao 2012-12-20 16:32:09 +01:00
parent 7ebeaf9f48
commit ee3d248afb
3 changed files with 13 additions and 12 deletions

View File

@ -1,6 +1,14 @@
Changelog Changelog
========= =========
0.3dev-20121221
---------------
*Date: 2012-12-21*
* YouTube: fix `#45 <https://github.com/soimort/you-get/issues/45>`_.
* Merge pull request `#46 <https://github.com/soimort/you-get/pull/46>`_; fix title parsing issue on Tudou.
0.3dev-20121220 0.3dev-20121220
--------------- ---------------

View File

@ -30,19 +30,12 @@ def youtube_download_by_id(id, title = None, output_dir = '.', merge = True, inf
'17', '17',
'13', '13',
]: ]:
fmt = r1(r'url=([^,]+)\\u0026itag=' + itag + ",", html) fmt = r1(r'([^,\"]*itag=' + itag + "[^,\"]*)", html)
if fmt: if fmt:
url = r1(r'([^\\]+)\\u0026', fmt) url = r1(r'url=([^\\]+)', fmt)
if not url:
continue
url = unicodize(url) url = unicodize(url)
url = parse.unquote(url) url = parse.unquote(url)
sig = r1(r'sig=([^\\]+)', fmt)
sig = r1(r'sig=([^\\]+)\\u0026', fmt)
if not sig:
continue
url = url + '&signature=' + sig url = url + '&signature=' + sig
break break
try: try:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python
__version__ = '0.3dev-20121220' __version__ = '0.3dev-20121221'
__date__ = '2012-12-20' __date__ = '2012-12-21'