Home Backend Development Python Tutorial How to call youget in python

How to call youget in python

Jun 25, 2019 am 11:30 AM
python

You-Get is a small command line utility for downloading media content (videos, audios, images) from the web in case there is no other convenient method. The following dependencies are required and must be installed separately unless you are using a prebuilt package or chocolate package on Windows:

Python 3
FFmpeg (highly recommended) or Libav (optional)

RTMPDump

How to call youget in python

Option 1: Install via pip The official you-get is released on PyPI and can be installed via
pip package manager installs easily from PyPI mirrors.
Please note that you must use the Python 3 version of pip:

$ pip3 install you-get
Copy after login

Option 2: Install via antigen Add the following line to your .zshrc:

antigen bundle soimort/you-get
Copy after login

Option 3: Download the exe (standalone) or 7z (including all dependencies) using a pre-built package (Windows only) from:

[https](https://github.com/soimort/you-get/releases/latest):[//github.com/soimort/you-get/releases/latest](https://github.com/soimort/you-get/releases/latest)。
Copy after login

Option 4: Download from GitHub You can download the stable (same as the latest version on PyPI) or the development (more fixes, unstable features) branch you-get.

Related recommendations: "Python Video Tutorial"

Unzip it and put the directory containing the you-get script into PATH. Alternatively, run

$ [sudo] python3 setup.py install
Copy after login

or

$ python3 setup.py install --user
Copy after login

to install you-get to a permanent path.

Option 5: Git Clone This is the recommended method for all developers, even if you don’t code in Python often.

$ git clone git://github.com/soimort/you-get.git
Copy after login

Then put the cloned directory into your directory PATH, or run ./setup.py install to install you-get to a permanent path.

Option 6: Use Chocolatey (Windows only)

> choco install you-get
Copy after login

Option 7: Homebrew (Mac only)
You can -Get easily installed via:

$ brew install you-get
Copy after login

Shell completion Completion definitions for Bash, Fish and Zsh can be found in contrib/completion. Please refer to your shell manual to learn how to exploit them.

Upgrade
Depending on the option you-get you choose to install, you can upgrade via:

$ pip3 install --upgrade you-get
Copy after login

or download the latest version via:

$ you-get https://github.com/soimort/you-get/archive/master.zip
Copy after login

Or use the chocolate package manager:

> choco upgrade you-get
Copy after login

To get the latest develop branch without littering the PIP, you can try:

$ pip3 install --upgrade git+https://github.com/soimort/you-get@develop
Copy after login

Use

When you receive a video you are interested in, you can use the --info/ -i option to see all available qualities and formats:

$ you-get -i 'https://www.youtube.com/watch?v=jNQXAC9IVRw'site: YouTube
title: Me at the zoo
streams: # Available quality and codecs[ DEFAULT ] _________________________________
- itag: 43container: webm
quality: medium
size: 0.5 MiB (564215 bytes)
# download-with: you-get --itag=43 [URL]- itag: 18
container: mp4
quality: medium
# download-with: you-get --itag=18 [URL]- itag: 5
container: flv
quality: small
# download-with: you-get --itag=5 [URL]- itag: 36
container: 3gp
quality: small
# download-with: you-get --itag=36 [URL]- itag: 17
container: 3gp
quality: small
# download-with: you-get --itag=17 [URL]
Copy after login

The formats marked DEFAULT are the ones you will get by default format. If this looks cool, you download it:

$ you-get 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
site: YouTube
title: Me at the zoo
stream:
- itag: 43
container: webm
quality: medium
size: 0.5 MiB (564215 bytes)
# download-with: you-get --itag=43 [URL]
Downloading zoo.webm ...
100.0% ( 0.5/0.5 MB) ├████████████████████████████████████████┤[1/1] 7 MB/s
Saving Me at the zoo.en.srt ...Done.
Copy after login

(If the YouTube video has any subtitles, they will be downloaded along with the video file in SubRip subtitle format.) Or if you prefer another format (mp4), just use the options you-get shows you:

$ you-get --itag=18 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
Copy after login

NOTE:
· At this point, most of our support sites generally do not implement format selection; in this case , the default format to download is the highest quality format.
·ffmpeg is a required dependency for downloading and joining multiple parts of a stream (e.g. on some sites like Youku), as well as videos in 1080p or high resolution YouTube videos.
If you-get don’t want to join the video part after downloading, please use the --no-merge/ -n option.

Download anything else
If you already have the URL of the resource you need, you can download it directly from:

$ you-get https://stallman.org/rms. 
Site: stallman.org
Title: rms
Type: JPEG Image (image/jpeg)
Size: 0.06 MiB (66482 Bytes)
Downloading rms.jpg ...
100.0% ( 0.1/0.1 MB) ├████████████████████████████████████████┤[1/1] 127 kB/s
Copy after login

Otherwise, you-get will scrape Take a web page and try to find out if there's anything interesting for you:

$ you-get http://kopasas.tumblr.com/post/69361932517
Site: Tumblr.com
Title: kopasas
Type: Unknown type (None)
Size: 0.51 MiB (536583 Bytes)
Site: Tumblr.com
Title: tumblr_mxhg13jx4n1sftq6do1_1280
Type: Portable Network Graphics (image/png)
Size: 0.51 MiB (536583 Bytes)
Downloading tumblr_mxhg13jx4n1sftq6do1_1280.png ...
100.0% ( 0.5/0.5 MB) ├████████████████████████████████████████┤[1/1] 22 MB/s
Copy after login

Note:
This feature is an experimental and is far from perfect. It works best for scraping large images from popular sites like Tumblr and Blogger, but there's really no universal pattern that can be applied to any site on the internet.

Search in Google Video and download

You can pass anything you-get. If the URL is not a valid one, you-get will perform a Google search and download the most relevant video for you. (This may not be what you want to see, but it's still possible.)

$ you-get "Richard Stallman eats"
Copy after login

Pause and resume downloads You can use Ctrl C to interrupt a download. Temporary .download files remain in the output directory. The next time you-get is run with the same parameters, download progress will resume from the previous session. If the file is downloaded completely (the temporary .download extension has been removed), you-get will skip the download.

To force a re-download, use the --force/ -f option. (Warning: Doing so will overwrite any existing files or temporary files with the same name!)

Set the path and name of the downloaded file

Use --output- dir/ -o option sets the path, and --output-filename/ -O sets the name of the downloaded file:

$ you-get -o ~/Videos -O zoo.webm 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
Copy after login

Tips:
· If you encounter the default video title (which may contain the same name as the current shell / These options are useful when you encounter problems with operating system/file system incompatible special characters).
·These options are also useful if you write a script to batch download files and put them into a folder with a specified name.

Proxy Settings
You-get to specify the HTTP proxy to use via the --http-proxy/ -x option:

$ you-get -x 127.0.0.1:8087 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
Copy after login

但是,http_proxy默认情况下应用系统代理设置(即环境变量)。要禁用任何代理,请使用该--no-proxy选项。

提示:
如果你需要使用代理了很多(如果您的网络阻止某些网站),你可能希望使用you-get与proxychains并设置alias you-get="proxychains -q you-get"(Bash中)。

对于某些网站(例如优酷),如果您需要访问仅在中国大陆可用的一些视频,可以使用特定代理从网站提取视频信息:--extractor-proxy/ -y。

观看视频
使用--player/ -p选项将视频馈送到您选择的媒体播放器,例如mplayer或vlc,而不是下载:

$ you-get -p vlc 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
Copy after login

或者,如果您更喜欢在浏览器中观看视频,只需没有广告或评论部分:

$ you-get -p chromium 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
Copy after login

提示:
可以使用该-p选项来启动另一个下载管理器,例如you-get -p uget-gtk 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
,尽管它们可能不能一起播放很好。

加载Cookie
并非所有视频都向任何人公开。如果您需要登录帐户以访问某些内容(例如,私人视频),则无法you-get通过--cookies/ -c选项向浏览器提供Cookie 。

注意:
到目前为止,我们支持两种格式的浏览器Cookie:Mozilla cookies.sqlite和Netscape cookies.txt。

重新使用提取的数据
使用--url/ -u获取从页面提取的可下载资源URL的列表。用于--json以JSON格式获取抽取数据的摘要。

The above is the detailed content of How to call youget in python. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1667
14
PHP Tutorial
1273
29
C# Tutorial
1255
24
PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

Choosing Between PHP and Python: A Guide Choosing Between PHP and Python: A Guide Apr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

How to run sublime code python How to run sublime code python Apr 16, 2025 am 08:48 AM

To run Python code in Sublime Text, you need to install the Python plug-in first, then create a .py file and write the code, and finally press Ctrl B to run the code, and the output will be displayed in the console.

PHP and Python: A Deep Dive into Their History PHP and Python: A Deep Dive into Their History Apr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Python vs. JavaScript: The Learning Curve and Ease of Use Python vs. JavaScript: The Learning Curve and Ease of Use Apr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Golang vs. Python: Performance and Scalability Golang vs. Python: Performance and Scalability Apr 19, 2025 am 12:18 AM

Golang is better than Python in terms of performance and scalability. 1) Golang's compilation-type characteristics and efficient concurrency model make it perform well in high concurrency scenarios. 2) Python, as an interpreted language, executes slowly, but can optimize performance through tools such as Cython.

Where to write code in vscode Where to write code in vscode Apr 15, 2025 pm 09:54 PM

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

How to run python with notepad How to run python with notepad Apr 16, 2025 pm 07:33 PM

Running Python code in Notepad requires the Python executable and NppExec plug-in to be installed. After installing Python and adding PATH to it, configure the command "python" and the parameter "{CURRENT_DIRECTORY}{FILE_NAME}" in the NppExec plug-in to run Python code in Notepad through the shortcut key "F6".

See all articles