hbmartin commited on
Commit
beb68c9
·
1 Parent(s): 766d18b

formatting fixes

Browse files
pytube/cli.py CHANGED
@@ -171,7 +171,7 @@ def on_progress(
171
 
172
 
173
  def _download(stream: Stream) -> None:
174
- print("\n{fn} | {fs} bytes".format(fn=stream.default_filename, fs=stream.filesize, ))
175
  stream.download()
176
  sys.stdout.write("\n")
177
 
@@ -215,7 +215,11 @@ def download_by_resolution(youtube: YouTube, resolution: str) -> None:
215
  # TODO(nficano): allow dash itags to be selected
216
  stream = youtube.streams.get_by_resolution(resolution)
217
  if stream is None:
218
- print("Could not find a stream with resolution: {resolution}".format(resolution=resolution))
 
 
 
 
219
  print("Try one of these:")
220
  display_streams(youtube)
221
  sys.exit()
 
171
 
172
 
173
  def _download(stream: Stream) -> None:
174
+ print("\n{fn} | {fs} bytes".format(fn=stream.default_filename, fs=stream.filesize))
175
  stream.download()
176
  sys.stdout.write("\n")
177
 
 
215
  # TODO(nficano): allow dash itags to be selected
216
  stream = youtube.streams.get_by_resolution(resolution)
217
  if stream is None:
218
+ print(
219
+ "Could not find a stream with resolution: {resolution}".format(
220
+ resolution=resolution
221
+ )
222
+ )
223
  print("Try one of these:")
224
  display_streams(youtube)
225
  sys.exit()
pytube/contrib/playlist.py CHANGED
@@ -21,11 +21,12 @@ class Playlist:
21
  def __init__(self, url: str, suppress_exception: bool = False):
22
  self.video_urls: List[str] = []
23
  self.suppress_exception = suppress_exception
24
- self.playlist_url:str = url
25
 
26
  if "watch?v=" in url:
27
  base_url = "https://www.youtube.com/playlist?list="
28
- playlist_code = self.playlist_url.split("&list=")[1] # TODO: should be parse q
 
29
  self.playlist_url = base_url + playlist_code
30
 
31
  @staticmethod
 
21
  def __init__(self, url: str, suppress_exception: bool = False):
22
  self.video_urls: List[str] = []
23
  self.suppress_exception = suppress_exception
24
+ self.playlist_url: str = url
25
 
26
  if "watch?v=" in url:
27
  base_url = "https://www.youtube.com/playlist?list="
28
+ # TODO: should be parse q
29
+ playlist_code = self.playlist_url.split("&list=")[1]
30
  self.playlist_url = base_url + playlist_code
31
 
32
  @staticmethod
pytube/request.py CHANGED
@@ -6,7 +6,7 @@ from urllib.request import urlopen
6
 
7
 
8
  def _execute_request(url: str) -> Any:
9
- if not url.lower().startswith('http'):
10
  raise ValueError
11
  return urlopen(Request(url, headers={"User-Agent": "Mozilla/5.0"}))
12
 
 
6
 
7
 
8
  def _execute_request(url: str) -> Any:
9
+ if not url.lower().startswith("http"):
10
  raise ValueError
11
  return urlopen(Request(url, headers={"User-Agent": "Mozilla/5.0"}))
12