Richard Borcsik commited on
Commit
0275bdb
·
1 Parent(s): e3bd6a1

PEP8 cleanup.

Browse files
Files changed (5) hide show
  1. pytube/__init__.py +0 -1
  2. pytube/api.py +8 -7
  3. pytube/models.py +3 -3
  4. pytube/utils.py +1 -0
  5. setup.py +9 -8
pytube/__init__.py CHANGED
@@ -5,4 +5,3 @@ __license__ = 'MIT License'
5
  __copyright__ = 'Copyright 2013 Nick Ficano'
6
 
7
  from .api import YouTube
8
-
 
5
  __copyright__ = 'Copyright 2013 Nick Ficano'
6
 
7
  from .api import YouTube
 
pytube/api.py CHANGED
@@ -51,6 +51,7 @@ YT_ENCODING_KEYS = (
51
  'audio_codec', 'audio_bitrate'
52
  )
53
 
 
54
  class YouTube(object):
55
  _filename = None
56
  _fmt_values = []
@@ -179,23 +180,23 @@ class YouTube(object):
179
 
180
  def _parse_stream_map(self, data):
181
  """
182
- Python's `parse_qs` can't properly decode the stream map
183
  containing video data so we use this instead.
184
 
185
  Keyword arguments:
186
  data -- The parsed response from YouTube.
187
  """
188
  videoinfo = {
189
- "itag": [],
190
- "url": [],
191
- "quality": [],
192
- "fallback_host": [],
193
- "sig": [],
194
  "type": []
195
  }
196
  text = data["url_encoded_fmt_stream_map"][0]
197
  # Split individual videos
198
- videos = text.split(",")
199
  # Unquote the characters and split to parameters
200
  videos = [video.split("&") for video in videos]
201
 
 
51
  'audio_codec', 'audio_bitrate'
52
  )
53
 
54
+
55
  class YouTube(object):
56
  _filename = None
57
  _fmt_values = []
 
180
 
181
  def _parse_stream_map(self, data):
182
  """
183
+ Python's `parse_qs` can't properly decode the stream map
184
  containing video data so we use this instead.
185
 
186
  Keyword arguments:
187
  data -- The parsed response from YouTube.
188
  """
189
  videoinfo = {
190
+ "itag": [],
191
+ "url": [],
192
+ "quality": [],
193
+ "fallback_host": [],
194
+ "sig": [],
195
  "type": []
196
  }
197
  text = data["url_encoded_fmt_stream_map"][0]
198
  # Split individual videos
199
+ videos = text.split(",")
200
  # Unquote the characters and split to parameters
201
  videos = [video.split("&") for video in videos]
202
 
pytube/models.py CHANGED
@@ -2,6 +2,7 @@ from __future__ import unicode_literals
2
  from os.path import normpath
3
  from urllib2 import urlopen
4
 
 
5
  class Video(object):
6
  """
7
  Class representation of a single instance of a YouTube video.
@@ -20,7 +21,7 @@ class Video(object):
20
  self.url = url
21
  self.filename = filename
22
  self.__dict__.update(**attributes)
23
-
24
  def download(self, path=None, chunk_size=8*1024,
25
  on_progress=None, on_finish=None):
26
  """
@@ -53,13 +54,12 @@ class Video(object):
53
  if on_finish:
54
  on_finish(fullpath)
55
  break
56
-
57
  self._bytes_received += len(self._buffer)
58
  dst_file.write(self._buffer)
59
  if on_progress:
60
  on_progress(self._bytes_received, file_size)
61
 
62
-
63
  def __repr__(self):
64
  """A cleaner representation of the class instance."""
65
  return "<Video: %s (.%s) - %s>" % (self.video_codec, self.extension,
 
2
  from os.path import normpath
3
  from urllib2 import urlopen
4
 
5
+
6
  class Video(object):
7
  """
8
  Class representation of a single instance of a YouTube video.
 
21
  self.url = url
22
  self.filename = filename
23
  self.__dict__.update(**attributes)
24
+
25
  def download(self, path=None, chunk_size=8*1024,
26
  on_progress=None, on_finish=None):
27
  """
 
54
  if on_finish:
55
  on_finish(fullpath)
56
  break
57
+
58
  self._bytes_received += len(self._buffer)
59
  dst_file.write(self._buffer)
60
  if on_progress:
61
  on_progress(self._bytes_received, file_size)
62
 
 
63
  def __repr__(self):
64
  """A cleaner representation of the class instance."""
65
  return "<Video: %s (.%s) - %s>" % (self.video_codec, self.extension,
pytube/utils.py CHANGED
@@ -1,5 +1,6 @@
1
  import re
2
 
 
3
  def safe_filename(text, max_length=200):
4
  """
5
  Sanitizes filenames for many operating systems.
 
1
  import re
2
 
3
+
4
  def safe_filename(text, max_length=200):
5
  """
6
  Sanitizes filenames for many operating systems.
setup.py CHANGED
@@ -6,21 +6,22 @@ PyTube
6
  -------
7
  """
8
 
 
9
  def read(fname):
10
  return open(os.path.join(os.path.dirname(__file__), fname)).read()
11
 
12
  setup(
13
- name = "pytube",
14
- version = "0.0.5",
15
- author = "Nick Ficano",
16
- author_email = "[email protected]",
17
- description = "A simple, yet versatile package for downloading YouTube videos.",
18
  license='The MIT License: http://www.opensource.org/licenses/mit-license.php',
19
- keywords = "youtube downloader",
20
- url = "https://github.com/NFicano/python-youtube-download",
21
  download_url="https://github.com/NFicano/python-youtube-download/tarball/master",
22
  packages=['pytube'],
23
- use_2to3= True,
24
  long_description=read('README.md'),
25
  classifiers=[
26
  "Development Status :: 4 - Beta",
 
6
  -------
7
  """
8
 
9
+
10
  def read(fname):
11
  return open(os.path.join(os.path.dirname(__file__), fname)).read()
12
 
13
  setup(
14
+ name="pytube",
15
+ version="0.0.5",
16
+ author="Nick Ficano",
17
+ author_email="[email protected]",
18
+ description="A simple, yet versatile package for downloading YouTube videos.",
19
  license='The MIT License: http://www.opensource.org/licenses/mit-license.php',
20
+ keywords="youtube downloader",
21
+ url="https://github.com/NFicano/python-youtube-download",
22
  download_url="https://github.com/NFicano/python-youtube-download/tarball/master",
23
  packages=['pytube'],
24
+ use_2to3=True,
25
  long_description=read('README.md'),
26
  classifiers=[
27
  "Development Status :: 4 - Beta",