Janusz Paszyński commited on
Commit
8d0500d
·
1 Parent(s): 630c299

- ported to 3.4.1 with backward compatibility

Browse files
Files changed (2) hide show
  1. pytube/api.py +1 -1
  2. scripts/pytubectl +6 -6
pytube/api.py CHANGED
@@ -278,7 +278,7 @@ class YouTube(object):
278
  stream_map['s'][0])
279
  url += '&signature=' + signature
280
  has_decrypted_signature = True
281
- except TypeError, e:
282
  pass
283
 
284
  if not has_decrypted_signature:
 
278
  stream_map['s'][0])
279
  url += '&signature=' + signature
280
  has_decrypted_signature = True
281
+ except TypeError:
282
  pass
283
 
284
  if not has_decrypted_signature:
scripts/pytubectl CHANGED
@@ -32,7 +32,7 @@ def _main():
32
  res_formts = yt.videos
33
  res_formts = ["%s %s" % (str(res_formts[index].extension), str(res_formts[index].resolution)) for index, video in enumerate(res_formts)]
34
  except YouTubeError:
35
- print "Incorrect video URL."
36
  sys.exit(1)
37
 
38
  if args.filename:
@@ -40,7 +40,7 @@ def _main():
40
 
41
  if args.ext or args.res:
42
  if not all([args.ext, args.res]):
43
- print "\nMake sure you give either of the below specified format/resolution combination.\n"
44
  pprint(res_formts)
45
  sys.exit(1)
46
 
@@ -49,7 +49,7 @@ def _main():
49
  vid = yt.get(args.ext, args.res)
50
  # Check if there's a video returned
51
  if not vid:
52
- print "\nThere's no video with the specified format/resolution combination.\n"
53
  pprint(res_formts)
54
  sys.exit(1)
55
 
@@ -58,7 +58,7 @@ def _main():
58
  videos = yt.filter(extension=args.ext)
59
  # Check if we have a video
60
  if not videos:
61
- print "There are no videos in the specified format."
62
  sys.exit(1)
63
  # Select the highest resolution one
64
  vid = max(videos)
@@ -67,7 +67,7 @@ def _main():
67
  videos = yt.filter(res=args.res)
68
  # Check if we have a video
69
  if not videos:
70
- print "There are no videos in the specified in the specified resolution."
71
  sys.exit(1)
72
  # Select the highest resolution one
73
  vid = max(videos)
@@ -78,7 +78,7 @@ def _main():
78
  try:
79
  vid.download(path=args.path, on_progress=print_status)
80
  except KeyboardInterrupt:
81
- print "Download interrupted."
82
  sys.exit(1)
83
 
84
  if __name__ == '__main__':
 
32
  res_formts = yt.videos
33
  res_formts = ["%s %s" % (str(res_formts[index].extension), str(res_formts[index].resolution)) for index, video in enumerate(res_formts)]
34
  except YouTubeError:
35
+ print("Incorrect video URL.")
36
  sys.exit(1)
37
 
38
  if args.filename:
 
40
 
41
  if args.ext or args.res:
42
  if not all([args.ext, args.res]):
43
+ print("\nMake sure you give either of the below specified format/resolution combination.\n")
44
  pprint(res_formts)
45
  sys.exit(1)
46
 
 
49
  vid = yt.get(args.ext, args.res)
50
  # Check if there's a video returned
51
  if not vid:
52
+ print("\nThere's no video with the specified format/resolution combination.\n")
53
  pprint(res_formts)
54
  sys.exit(1)
55
 
 
58
  videos = yt.filter(extension=args.ext)
59
  # Check if we have a video
60
  if not videos:
61
+ print("There are no videos in the specified format.")
62
  sys.exit(1)
63
  # Select the highest resolution one
64
  vid = max(videos)
 
67
  videos = yt.filter(res=args.res)
68
  # Check if we have a video
69
  if not videos:
70
+ print("There are no videos in the specified in the specified resolution.")
71
  sys.exit(1)
72
  # Select the highest resolution one
73
  vid = max(videos)
 
78
  try:
79
  vid.download(path=args.path, on_progress=print_status)
80
  except KeyboardInterrupt:
81
+ print("Download interrupted.")
82
  sys.exit(1)
83
 
84
  if __name__ == '__main__':