Use you-get tool to download B station video

Today I wanted to download a video on station b, but found that the previous websites were not very easy to use, so I went to Mouhu to find a way. After reading Gao Zan's answer, I found that a better solution is the python+you-get tool . The github homepage of the tool is here: you-get homepage , and the relevant installation steps are also inside.

1. Download python

First go to the python official website to find the python installation package, but found that the download speed is extremely slow, even after surfing the Internet is very slow, so I want to go to a third-party website to download the image of the installation package, but I did not find a more reliable image of the python installation package Website, only found some domestic mirror websites on csdn to speed up the download of pip3 command.

阿里云 https://mirrors.aliyun.com/pypi/simple/ 
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 
豆瓣(douban) https://pypi.douban.com/simple/ 
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 
中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple/

So I thought about whether python can be found in the store that comes with win10. I tried it and it was really good~
but the download speed was too slow, and I searched for related solutions on Baidu, and finally got it through the method of debugging on the following webpage. A decent download speed: Microsoft’s official solution

2. Install you-get tool through cmd

First enter: on the command line pip3 install you-get, and after waiting for a few minutes, I found that the download failed, so I used the domestic mirror website mentioned at the beginning of this article. The method of use is to installadd it later -i 镜像网站地址, so I typed the following command:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple you-get

After installing the you-get tool, you need to upgrade: pip3 install --upgrade you-get
At this time, a warning in yellow font will appear in the cmd window, indicating that the pip download tool is not up-to-date, so you enter the pip upgrade command: python -m pip install --upgrade pip, but the upgrade fails. . . No, how can this be tolerated!
Find a way from the Internet: write the address of the mirror website into the pip configuration file, so that no matter what tool you use pip to download in the future, it will have a very fast speed. The steps are as follows:
1. Win+R to open the running window, input %HOMEPATH%to create a pip directory in the pop-up directory, and create a new file pip.ini in it, fill in:

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/ 

[install]
trusted-host=mirrors.aliyun.com

After restarting cmd, upgrade pip again, and finally the upgrade is successful.

3. Run you-get tool

The format of the command to download the video is: you-get 视频网址
Enter the above command with excitement, but it prompts: "Not an internal or external file"
. . . . . The next video is too difficult. . .
I think the environment variables should not be configured properly, but after thinking about it, where is my python installed? It was downloaded through the Microsoft store, but before downloading, in order to save the downloaded file on the F drive, I manually modified the file save location in the settings. Logically speaking, the file should now exist on the F drive. Search for "you -get" found the following paths:

F:\WpSystem\S-1-5-21-169552699-3695918580-3083524189-1000\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts\

The inside is like this:
script storage location
the location of the script is found, but where is the python itself? Open the python command line and enter:

import sys
sys.executable

python path
So I found the python path :

C:\\Users\\hasee\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\

Finally, add the above two paths to the environment variable at the same time:
Add to environment variable
Then open cmd again, enter you-get, and it will appear:
you-get runs successfully
Yes, it is the result I want~
Test it:
test download
the video is stored in the location indicated by the red line, which is strange It is downloaded as two files, one is audio and the other is video, both in mp4 format. It should be that the tool does not have the function of automatically merging video streams, and a third-party tool is required.
I downloaded a ffmepg, but found that the decompressed file is a folder, and there is no installation program, so there is no way to change the registry, system variables, etc., so that the you-get tool can automatically recognize the location of ffmepg and perform video processing.
So, this is a problem I have never been exposed to, and now I don't know how to combine ffmpeg with python, probably using a command line to call it. . .
However, merging audio and video is not difficult, just download individual video tools and it will be ok, so I won’t say much here.

Guess you like

Origin blog.csdn.net/Ka__ze/article/details/104672934