projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unnecessary TODO-comments
[youtube-dl]
/
youtube_dl
/
YoutubeDL.py
diff --git
a/youtube_dl/YoutubeDL.py
b/youtube_dl/YoutubeDL.py
index 14e92ddcf7258d60b38b8816005b089a0801cb37..1730df4cd40b174404168ed73f4438e6d02d2847 100755
(executable)
--- a/
youtube_dl/YoutubeDL.py
+++ b/
youtube_dl/YoutubeDL.py
@@
-25,6
+25,7
@@
if os.name == 'nt':
import ctypes
from .compat import (
import ctypes
from .compat import (
+ compat_basestring,
compat_cookiejar,
compat_expanduser,
compat_http_client,
compat_cookiejar,
compat_expanduser,
compat_http_client,
@@
-963,9
+964,11
@@
class YoutubeDL(object):
thumbnails.sort(key=lambda t: (
t.get('preference'), t.get('width'), t.get('height'),
t.get('id'), t.get('url')))
thumbnails.sort(key=lambda t: (
t.get('preference'), t.get('width'), t.get('height'),
t.get('id'), t.get('url')))
- for
t in thumbnails
:
+ for
i, t in enumerate(thumbnails)
:
if 'width' in t and 'height' in t:
t['resolution'] = '%dx%d' % (t['width'], t['height'])
if 'width' in t and 'height' in t:
t['resolution'] = '%dx%d' % (t['width'], t['height'])
+ if t.get('id') is None:
+ t['id'] = '%d' % i
if thumbnails and 'thumbnail' not in info_dict:
info_dict['thumbnail'] = thumbnails[-1]['url']
if thumbnails and 'thumbnail' not in info_dict:
info_dict['thumbnail'] = thumbnails[-1]['url']
@@
-1074,8
+1077,8
@@
class YoutubeDL(object):
selected_format = {
'requested_formats': formats_info,
'format': rf,
selected_format = {
'requested_formats': formats_info,
'format': rf,
- 'format_id':
rf
,
-
'ext': formats_info[0]['ext']
,
+ 'format_id':
'%s+%s' % (formats_info[0].get('format_id')
,
+
formats_info[1].get('format_id'))
,
'width': formats_info[0].get('width'),
'height': formats_info[0].get('height'),
'resolution': formats_info[0].get('resolution'),
'width': formats_info[0].get('width'),
'height': formats_info[0].get('height'),
'resolution': formats_info[0].get('resolution'),
@@
-1558,7
+1561,7
@@
class YoutubeDL(object):
# urllib chokes on URLs with non-ASCII characters (see http://bugs.python.org/issue3991)
# To work around aforementioned issue we will replace request's original URL with
# percent-encoded one
# urllib chokes on URLs with non-ASCII characters (see http://bugs.python.org/issue3991)
# To work around aforementioned issue we will replace request's original URL with
# percent-encoded one
- req_is_string = isinstance(req,
basestring if sys.version_info < (3, 0) else compat_str
)
+ req_is_string = isinstance(req,
compat_basestring
)
url = req if req_is_string else req.get_full_url()
url_escaped = escape_url(url)
url = req if req_is_string else req.get_full_url()
url_escaped = escape_url(url)