Simple version of website b video downloader implemented in java
Because a friend suddenly asked for this requirement yesterday, I spent the whole morning writing a simplified version.
Because it is written in java and it is only one file, it is not packaged and compiled. There's no point in packing it. As for compilation, let the programmer use it to look at the source code, and then modify it himself if there are other needs. There are more than 200 lines in total, and there are so many blank lines, so there is no technical difficulty.
The total files are a startup file (java format) and a configuration file (properties format), a total of two files.
Before use, no Java is required. I developed it based on Java1.8.
There is java, and then it is in the command line tool. Enter the full pathname of the javac java file (including .class). You can change to the directory of the java file first, and then directly javac the file name. compile
After compilation, a java file with the same name is generated. Then enter the full pathname of the java file (excluding .java) on the command line. Or you can also change to the directory of the java file first, and then start it directly with the java file name.
But there are a few things to do before starting.
Please put the configuration file and startup file in the same directory.
Then configure the configuration file
The configuration file has two parameters
One is the download path. Everyone knows this. You can configure it wherever you want to download it. Don't forget to add a slash at the end of the path. What slash depends on your system.
The other one is a cookie. It is because of this cookie that we can imitate a real visit to obtain the video address that changes the resolution according to the default resolution set by your account.
Taking Google Chrome as an example, first enter a video, then right-click -> Check -> application -> Cookies -> https://www.bilibili.com
Then a cookie list appears, you just look for the long string starting with _uuid which is the value of this key, copy it, and then paste it into the configuration file, and it's OK.
Someone may ask, do I need to configure it every time? , in fact, this involves the cookie principle. The storage period of cookies is very long. Although I didn't check the storage period of site B, it must be a week.
You visit station b again in the middle. His time will be refreshed. I don’t know what the mechanism of station b is, but it should be similar. Once the copy is complete, feel free to use it.
Have you ever encountered that when you log in to station B every day, you don’t need to log in with your account and password? Then occasionally you need to log in, maybe because of a problem with the server of station B, or because you haven’t logged in for a long time and it has expired.
This is the same situation as above.
Then you can start it through the java file name mentioned before (excluding the suffix).
First enter the av number (required), then enter the p number. If you do not enter the p number and press Enter directly, the default is p=1.
Then enter the download sequence, please wait patiently.
The video format of station B is flv format, and I have not changed it because I personally think this format is very good. very clear