nficano commited on
Commit
68bf686
·
1 Parent(s): 4c28904

Updated README and AUTHORS.

Browse files
Files changed (4) hide show
  1. AUTHORS +4 -0
  2. README.md +114 -0
  3. README.rst +0 -51
  4. TODO +4 -11
AUTHORS CHANGED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Author: Nick Ficano <[email protected]>
2
+
3
+ Contributors:
4
+ Lorenzo Gil Sanchez <[email protected]>
README.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ![pytube](https://s3.amazonaws.com/assets.nickficano.com/pytube_logo.png)
2
+
3
+ # A lightwight, dependency-free YouTube Video download library, written in Python.
4
+
5
+ Downloading videos from YouTube shouldn't require some bloatware application,
6
+ its usually a niche condition you need to do so in the first place.
7
+
8
+ ## Background
9
+
10
+ After missing the deadline to register for PyCon 2012, I decided to write what
11
+ became PyTube and crawler to collect all the YouTube links for the talks
12
+ on [PyVideos.org](http://pyvideo.org/).
13
+
14
+ To avoid having to encode them to mp4 (so I could watch them on my iPhone)
15
+ I wrote it so you could specify an encoding format.
16
+
17
+ In recently weeks interest has picked up in the project, so I decided to
18
+ dedicate more time to further its development and actively maintain it.
19
+
20
+ ## Principals
21
+
22
+ My only real goals for this is to never require any third party dependancies,
23
+ to keep it simple and make it reliable.
24
+
25
+ ## Planned Features
26
+
27
+ The only features I see implementing in the near future are:
28
+
29
+ - Allow it to run as a command-line utility.
30
+ - Making it compatible with Python 3.
31
+
32
+
33
+ ## Usage
34
+
35
+ ``` python
36
+ from youtube import YouTube
37
+
38
+ # not necessary, just for demo purposes
39
+ from pprint import pprint as pp
40
+
41
+ yt = YouTube()
42
+
43
+ # Set the video URL.
44
+ yt.url = "http://www.youtube.com/watch?v=Ik-RsDGPI5Y"
45
+
46
+ # Once set, you can see all the codec and quality options YouTube has made
47
+ # available for the perticular video by printing videos.
48
+
49
+ pp(yt.videos)
50
+
51
+ #[<Video: 3gp - 144p>,
52
+ # <Video: 3gp - 144p>,
53
+ # <Video: 3gp - 240p>,
54
+ # <Video: 3gp - 240p>,
55
+ # <Video: flv - 224p>,
56
+ # <Video: flv - 224p>,
57
+ # <Video: flv - 360p>,
58
+ # <Video: flv - 360p>,
59
+ # <Video: flv - 480p>,
60
+ # <Video: flv - 480p>,
61
+ # <Video: mp4 - 360p>,
62
+ # <Video: mp4 - 360p>,
63
+ # <Video: mp4 - 720p>,
64
+ # <Video: mp4 - 720p>,
65
+ # <Video: webm - 360p>,
66
+ # <Video: webm - 360p>,
67
+ # <Video: webm - 480p>,
68
+ # <Video: webm - 480p>]
69
+
70
+ # The filename is automatically generated based on the video title.
71
+ # You can override this by manually setting the filename.
72
+
73
+ # view the auto generated filename:
74
+ print yt.filename
75
+
76
+ #Pulp Fiction - Dancing Scene [HD]
77
+
78
+ # set the filename:
79
+ yt.filename = 'Dancing Scene from Pulp Fiction'
80
+
81
+ # You can also filter the criteria by filetype.
82
+
83
+ pp(yt.filter('flv'))
84
+
85
+ # [<Video: flv - 224p>,
86
+ # <Video: flv - 224p>,
87
+ # <Video: flv - 360p>,
88
+ # <Video: flv - 360p>,
89
+ # <Video: flv - 480p>,
90
+ # <Video: flv - 480p>]
91
+
92
+ # and by resolution
93
+ pp(yt.filter(res='480p'))
94
+
95
+ # [<Video: flv - 480p>,
96
+ # <Video: flv - 480p>,
97
+ # <Video: webm - 480p>,
98
+ # <Video: webm - 480p>]
99
+
100
+ # to select a video by a specific resolution and filetype you can use the get
101
+ # method.
102
+
103
+ video = yt.get('mp4', '720p')
104
+
105
+ # Okay, let's download it!
106
+ video.download()
107
+
108
+ # Downloading: Pulp Fiction - Dancing Scene.mp4 Bytes: 37561829
109
+ # 37561829 [100.00%]
110
+
111
+ # Note: If you wanted to choose the output directory, simply pass it as an
112
+ # argument to the download method.
113
+ video.download('/tmp/')
114
+ ```
README.rst DELETED
@@ -1,51 +0,0 @@
1
- python-youtube-downloader
2
- =========================
3
- Still needs a bit of cleaning up, and has a couple bugs, not bad for a
4
- couple hours of hackin'. I should have them fixed quickly though. Enjoy!
5
-
6
- TODO
7
- ----
8
- 1. Add a couple small features, like output path.
9
- 2. Write unit tests.
10
- 3. Add setup.py.
11
-
12
- Installation
13
- ------------
14
- 1. Add it to your PYTHON PATH if you'd like, not much to her.
15
-
16
- Usage example
17
- -------------
18
- ::
19
-
20
- >>> from youtube import YouTube
21
- >>> yt = YouTube()
22
- >>> yt.url = "http://www.youtube.com/watch?v=Ik-RsDGPI5Y"
23
-
24
- >>> # View all encoding/quality options.
25
- >>> yt.videos
26
- [<Video: mp4 - 720p>,
27
- <Video: webm - 480p>,
28
- <Video: flv - 480p>,
29
- <Video: webm - 360p>,
30
- <Video: flv - 360p>,
31
- <Video: mp4 - 360p>,
32
- <Video: flv - 224p>]
33
-
34
- >>> #Set the filename, or get the default.
35
- >>> yt.filename
36
- 'Pulp Fiction - Dancing Scene'
37
-
38
- >>> # Similar to the Django ORM, you can filter.
39
- >>> yt.filter('flv')
40
- [<Video: flv - 480p>, <Video: flv - 360p>, <Video: flv - 224p>]
41
-
42
- >>> yt.filter(res='480p')
43
- [<Video: webm - 480p>, <Video: flv - 480p>]
44
-
45
- >>> # You can even use get()
46
- >>> video = yt.get('mp4', '720p')
47
-
48
- >>> # Okay, let's download!
49
- >>> video.download()
50
- Downloading: Pulp Fiction - Dancing Scene.mp4 Bytes: 37561829
51
- 37561829 [100.00%]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
TODO CHANGED
@@ -1,19 +1,12 @@
1
  TODO
2
  ====
3
 
4
- Short Term
5
- ----------
6
- * Reimplement as Abstract Base Class.
7
- * Allow an output directory to be specified.
8
- * Unbind the filename from the Video class, to allow graceful file renaming.
9
- * Throw custom exceptions.
10
  * Detect duplicate video encoding options, preventing the creation of identical
11
  video class instances. (can cause get() method to raise unnecessary
12
  multiple returned excepion).
13
-
14
- Long Term
15
- ----------
16
- * OS Compatibility testing of automatic filename generation.
17
- * Improve automatic filename generation.
18
  * Add functionality for batch URL processing.
19
  * Scrape and inject additional video information into metadata.
 
1
  TODO
2
  ====
3
 
4
+ * Refactor filename out of ``Video`` class, allowing for graceful file
5
+ renaming. At present, the filename must be set before defining the url.
6
+ * Better handling and/or conditionally raising exceptions.
7
+ * Add setup.py.
 
 
8
  * Detect duplicate video encoding options, preventing the creation of identical
9
  video class instances. (can cause get() method to raise unnecessary
10
  multiple returned excepion).
 
 
 
 
 
11
  * Add functionality for batch URL processing.
12
  * Scrape and inject additional video information into metadata.