javad_ubuntu commited on
Commit
d4ed62c
1 Parent(s): 21f4f68

Change: update readme

Browse files
Files changed (1) hide show
  1. README.md +34 -45
README.md CHANGED
@@ -2,17 +2,8 @@
2
  <p>
3
  <a href="#"><img src="https://assets.nickficano.com/gh-pytube.min.svg" width="456" height="143" alt="pytube logo" /></a>
4
  </p>
5
- <p align="center">
6
- <a href="https://pypi.org/project/pytube/"><img src="https://img.shields.io/pypi/dm/pytube?style=flat-square" alt="pypi"/></a>
7
- <a href="https://pytube.io/en/latest/"><img src="https://readthedocs.org/projects/python-pytube/badge/?version=latest&style=flat-square" /></a>
8
- <a href="https://pypi.org/project/pytube/"><img src="https://img.shields.io/pypi/v/pytube?style=flat-square" /></a>
9
- </p>
10
  </div>
11
 
12
- ### Actively soliciting contributors!
13
-
14
- Have ideas for how pytube can be improved? Feel free to open an issue or a pull request!
15
-
16
  # pytube
17
 
18
  *pytube* is a genuine, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube videos.
@@ -21,17 +12,6 @@ Have ideas for how pytube can be improved? Feel free to open an issue or a pull
21
 
22
  Detailed documentation about the usage of the library can be found at [pytube.io](https://pytube.io). This is recommended for most cases. If you want to hastily download a single video, the [quick start](#Quickstart) guide below might be what you're looking for.
23
 
24
- ## Description
25
-
26
- YouTube is the most popular video-sharing platform in the world and as a hacker, you may encounter a situation where you want to script something to download videos. For this, I present to you: *pytube*.
27
-
28
- *pytube* is a lightweight library written in Python. It has no third-party
29
- dependencies and aims to be highly reliable.
30
-
31
- *pytube* also makes pipelining easy, allowing you to specify callback functions for different download events, such as ``on progress`` or ``on complete``.
32
-
33
- Furthermore, *pytube* includes a command-line utility, allowing you to download videos right from the terminal.
34
-
35
  ## Features
36
 
37
  - Support for both progressive & DASH streams
@@ -43,6 +23,8 @@ Furthermore, *pytube* includes a command-line utility, allowing you to download
43
  - Ability to capture thumbnail URL
44
  - Extensively documented source code
45
  - No third-party dependencies
 
 
46
 
47
  ## Quickstart
48
 
@@ -52,42 +34,49 @@ This guide covers the most basic usage of the library. For more detailed informa
52
 
53
  Pytube requires an installation of Python 3.6 or greater, as well as pip. (Pip is typically bundled with Python [installations](https://python.org/downloads).)
54
 
55
- To install from PyPI with pip:
56
 
57
  ```bash
58
- $ python -m pip install pytube
59
  ```
60
 
61
- Sometimes, the PyPI release becomes slightly outdated. To install from the source with pip:
62
 
63
- ```bash
64
- $ python -m pip install git+https://github.com/pytube/pytube
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  ```
66
 
67
- ### Using pytube in a Python script
68
 
69
- To download a video using the library in a script, you'll need to import the YouTube class from the library and pass an argument of the video URL. From there, you can access the streams and download them.
70
 
71
  ```python
72
- >>> from pytube import YouTube
73
- >>> YouTube('https://youtu.be/2lAe1cqCOXo').streams.first().download()
74
- >>> yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')
75
- >>> yt.streams
76
- ... .filter(progressive=True, file_extension='mp4')
77
- ... .order_by('resolution')
78
- ... .desc()
79
- ... .first()
80
- ... .download()
81
- ```
82
 
83
- ### Using the command-line interface
 
84
 
85
- Using the CLI is remarkably straightforward as well. To download a video at the highest progressive quality, you can use the following command:
86
- ```bash
87
- $ pytube https://youtube.com/watch?v=2lAe1cqCOXo
88
- ```
89
 
90
- You can also do the same for a playlist:
91
- ```bash
92
- $ pytube https://www.youtube.com/playlist?list=PLS1QulWo1RIaJECMeUT4LFwJ-ghgoSH6n
93
  ```
 
2
  <p>
3
  <a href="#"><img src="https://assets.nickficano.com/gh-pytube.min.svg" width="456" height="143" alt="pytube logo" /></a>
4
  </p>
 
 
 
 
 
5
  </div>
6
 
 
 
 
 
7
  # pytube
8
 
9
  *pytube* is a genuine, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube videos.
 
12
 
13
  Detailed documentation about the usage of the library can be found at [pytube.io](https://pytube.io). This is recommended for most cases. If you want to hastily download a single video, the [quick start](#Quickstart) guide below might be what you're looking for.
14
 
 
 
 
 
 
 
 
 
 
 
 
15
  ## Features
16
 
17
  - Support for both progressive & DASH streams
 
23
  - Ability to capture thumbnail URL
24
  - Extensively documented source code
25
  - No third-party dependencies
26
+ - Proxy support
27
+ - Suport for bulk downloading channel videos
28
 
29
  ## Quickstart
30
 
 
34
 
35
  Pytube requires an installation of Python 3.6 or greater, as well as pip. (Pip is typically bundled with Python [installations](https://python.org/downloads).)
36
 
37
+ To install using github:
38
 
39
  ```bash
40
+ $ python -m pip install git+https://github.com/javad-rzvn/pytube
41
  ```
42
 
43
+ ## Usage
44
 
45
+ If you have internet problem, you should use proxy. To do that, you better setup a ``v2ray`` connection, then use its proxy to download videos.
46
+
47
+ ### Download single video from youtube channel
48
+
49
+ ```python
50
+ from pytube import YouTube
51
+ from pytube.cli import on_progress
52
+
53
+ YouTube("https://youtu.be/2lAe1cqCOXo").streams.first().download()
54
+ proxies = {"http": "socks5://127.0.0.1:2080"}
55
+ yt = YouTube(
56
+ "http://youtube.com/watch?v=2lAe1cqCOXo",
57
+ on_progress_callback=on_progress,
58
+ # on_complete_callback=complete_func,
59
+ proxies=proxies,
60
+ )
61
+ yt.streams.filter(progressive=True, file_extension="mp4").order_by(
62
+ "resolution"
63
+ ).desc().first().download()
64
  ```
65
 
66
+ ### Download all channel's videos
67
 
68
+ In the example below, it downloads only 3 videos of the channel.
69
 
70
  ```python
71
+ from pytube import Channel
 
 
 
 
 
 
 
 
 
72
 
73
+ proxies = {"http": "socks5://127.0.0.1:2080"}
74
+ c = Channel('https://www.youtube.com/c/FalcomMusicChannel/videos', proxies=proxies)
75
 
76
+ print(f'Downloading videos by: {c.channel_name}')
77
+ print(f'Channel URLs: {c.video_urls[:3]}')
 
 
78
 
79
+ for i, video in enumerate(c.videos[:3]):
80
+ print(c.video_urls[i])
81
+ video.streams.first().download()
82
  ```