Jose Diaz-Gonzalez commited on
Commit
b272f24
·
1 Parent(s): 1c09b71

Whitespace cleanup

Browse files

As per PEP8, global functions need two newlines, class methods need 1, and all indentation should use spaces, not tabs

pytube/api.py CHANGED
@@ -265,12 +265,12 @@ class YouTube(object):
265
  fmt, fmt_data = self._extract_fmt(url)
266
  except (TypeError, KeyError):
267
  continue
268
-
269
  # If the signature must be ciphered...
270
  if "signature=" not in url:
271
  signature = self._cipher(stream_map["s"][i], js_url)
272
  url = "%s&signature=%s" % (url, signature)
273
-
274
  self.videos.append(Video(url, self.filename, **fmt_data))
275
  self._fmt_values.append(fmt)
276
  self.videos.sort()
@@ -291,7 +291,7 @@ class YouTube(object):
291
  try:
292
  code = re.findall(r"function \w{2}\(\w{1}\)\{\w{1}=\w{1}\.split\(\"\"\)\;(.*)\}", self._js_code)[0]
293
  code = code[:code.index("}")]
294
-
295
  signature = "a='" + s + "'"
296
 
297
  # Tiny JavaScript VM
 
265
  fmt, fmt_data = self._extract_fmt(url)
266
  except (TypeError, KeyError):
267
  continue
268
+
269
  # If the signature must be ciphered...
270
  if "signature=" not in url:
271
  signature = self._cipher(stream_map["s"][i], js_url)
272
  url = "%s&signature=%s" % (url, signature)
273
+
274
  self.videos.append(Video(url, self.filename, **fmt_data))
275
  self._fmt_values.append(fmt)
276
  self.videos.sort()
 
291
  try:
292
  code = re.findall(r"function \w{2}\(\w{1}\)\{\w{1}=\w{1}\.split\(\"\"\)\;(.*)\}", self._js_code)[0]
293
  code = code[:code.index("}")]
294
+
295
  signature = "a='" + s + "'"
296
 
297
  # Tiny JavaScript VM
pytube/exceptions.py CHANGED
@@ -11,8 +11,9 @@ class YouTubeError(Exception):
11
  """
12
  pass
13
 
 
14
  class CipherError(Exception):
15
- """
16
- The _cipher method returned an error.
17
- """
18
- pass
 
11
  """
12
  pass
13
 
14
+
15
  class CipherError(Exception):
16
+ """
17
+ The _cipher method returned an error.
18
+ """
19
+ pass
pytube/models.py CHANGED
@@ -100,7 +100,6 @@ class Video(object):
100
  remove(fullpath)
101
  exit(1)
102
 
103
-
104
  def __repr__(self):
105
  """A cleaner representation of the class instance."""
106
  return "<Video: {0} (.{1}) - {2} - {3}>".format(self.video_codec, self.extension,
 
100
  remove(fullpath)
101
  exit(1)
102
 
 
103
  def __repr__(self):
104
  """A cleaner representation of the class instance."""
105
  return "<Video: {0} (.{1}) - {2} - {3}>".format(self.video_codec, self.extension,
pytube/utils.py CHANGED
@@ -11,6 +11,7 @@ class FullPaths(argparse.Action):
11
  def __call__(self, parser, namespace, values, option_string=None):
12
  setattr(namespace, self.dest, path.abspath(path.expanduser(values)))
13
 
 
14
  def safe_filename(text, max_length=200):
15
  """
16
  Sanitizes filenames for many operating systems.
@@ -37,6 +38,7 @@ def safe_filename(text, max_length=200):
37
  filename = blacklist.sub('', text)
38
  return truncate(filename)
39
 
 
40
  def sizeof(bytes):
41
  """ Takes the size of file or folder in bytes and
42
  returns size formatted in kb, MB, GB, TB or PB.
 
11
  def __call__(self, parser, namespace, values, option_string=None):
12
  setattr(namespace, self.dest, path.abspath(path.expanduser(values)))
13
 
14
+
15
  def safe_filename(text, max_length=200):
16
  """
17
  Sanitizes filenames for many operating systems.
 
38
  filename = blacklist.sub('', text)
39
  return truncate(filename)
40
 
41
+
42
  def sizeof(bytes):
43
  """ Takes the size of file or folder in bytes and
44
  returns size formatted in kb, MB, GB, TB or PB.
scripts/pytubectl CHANGED
@@ -26,7 +26,7 @@ def _main():
26
 
27
  args = parser.parse_args()
28
 
29
- yt = YouTube()
30
  try:
31
  yt.url = args.url
32
  res_formts = yt.videos
@@ -82,4 +82,4 @@ def _main():
82
  sys.exit(1)
83
 
84
  if __name__ == '__main__':
85
- _main()
 
26
 
27
  args = parser.parse_args()
28
 
29
+ yt = YouTube()
30
  try:
31
  yt.url = args.url
32
  res_formts = yt.videos
 
82
  sys.exit(1)
83
 
84
  if __name__ == '__main__':
85
+ _main()