Most firmware files distributed by the manufacturers are uploaded to Baidu, but I’ve found the service not to be always reliable, especially for larger files. In Windows, people are recommended to use Baidu software (BaiduYunGuanjia), but there’s not such tool in Linux, so instead I investigate for command lines tools to download files from Baidu, and this lead me to two interesting tools called Aria2, a “lightweight multi-protocol & multi-source command-line download utility
But let’s start with the first tool I found: pan-baidu-download, a Python script to download files from Baidu.
To install it:
1 2 |
git clone https://github.com/banbanchs/pan-baidu-download.git cd pan-baidu-download |
We also need to install some dependencies (assuming python 2.7.x is already installed):
1 |
sudo apt-get install python-pip aria2 |
and then you can start downloading files as follows:
1 |
python bddown_cli.py download http://pan.baidu.com/s/somerandomcharacters |
But after posting a bug about password-protected download, which was fixed in 2 minutes by the developers, I was informed the script does not support directories, and was recommended to use BaiduExporter add-on for Chrome or Firefox instead.
Everything is in Chinese, and after installing the add-on I was not clear how to use it but I figured it out eventually.
First you need to run aria2c:
1 2 3 4 5 |
aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all 01/14 11:01:42 [NOTICE] IPv4 RPC: listening on TCP port 6800 01/14 11:01:42 [NOTICE] IPv6 RPC: listening on TCP port 6800 |
The command line above is insecure if you plan to run it on a remote server, as anybody could access it, and start download on your server. But for testing, and local download this will do. If you stop aria2c, the downloads won’t restart with this command, but there are options that support this, but again, I have not looked into details for this quick test.
Now go to the Baidu download link, select the files and/or folders you want to download, and provided you’ll already installed Baidu Exporter add-on, a new menu will be shown, and all you have to do is click on ARIA2 RPC to start the download in aria2. The last options with two Chinese ideogram is the option, where you can change the IP of the aria2 server (localhost:6800) by default as well as other settings.
You can now close the Baidu window in your web browser. and should see the download as started in the terminal:
1 |
aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all |
1 |
01/14 11:01:42 [NOTICE] IPv4 RPC: listening on TCP port 6800 |
1 2 3 4 5 |
01/14 11:01:42 [NOTICE] IPv6 RPC: listening on TCP port 6800 *** Download Progress Summary as of Wed Jan 14 11:07:30 2015 *** =============================================================================== [#af540e 0B/0B CN:1 DL:0B] FILE: /media/hdd/edev/sandbox/yaaw/binux-yaaw-ab09f92/update1201-android/update.zip |
This is all good, but in practise you’d probably want start aria2c when your computer boots and would not be able to monitor progress, especially if you use a remote server, and this is where YAAW comes into play.
To install it, check out the code from Github or download and extract the tar file. Now go to the directoty where you extract the file. and open index.html with your web browser. You can monitor download, or even add HTTP or Bittorrent Downloads. AFAIK, you can’t add Baidu links to YAAW directly, but you can monitor the downloads added via Baidu Exporter
The aria2c IP address and port can be changed in the settings directly from the main page. Some useful tips for YAAW:
- All your settings on web is temporary. Settings will be lost after aria2 restarted.
- Tasks (including those that are not finished) will be lost after aria2 is restarted. Use
--save-session=SOME/WHERE
and reload with--continue=true --input-file=SOME/WHERE
to continue.- Use
$HOME/.aria2/aria2.conf
to save your options.
I haven’t gone into details, but Aria2 and YAAW could be used with a NAS, a cheap board with a USB harddrive, or even USB Wireless flash drive such a Zsun SD111 (which is now hackable even without serial debug board, as the default root password has just been cracked) to make a downloader to handle large downloads instead of leaving your PC on at night, or 24/7.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
Why not just use Jdownloader?
So much easier, downloads fast, resumable downloads, entering capthas, works on Windows & Linux.
Might need to set chunks to only 1 for some downloads. Too many connections to Baidu and you have to re-enter a captcha code.
http://jdownloader.org/
@dewet
I did not know about it. I’ll give it a try.
Nice, thanks for those tips !
The main advantage I see over Jdownloader is that it’s a very much lighter solution and you can use it remotely in a client/server configuration.
Another solution is to copy to copy the file to your personal free 2To Baidu drive and then use this nice GUI linux solution for downloading/uploading/remote-uploading(via torrent) :
https://github.com/LiuLang/bcloud
It have the advantage to have an english interface and distribute debian packages and many others :
https://github.com/LiuLang/bcloud-packages
You can also stream media by right clicking on it and play it with your favorite media player 🙂
@Davy
Thanks. Bcloud is interesting too.
I’m now starting aria2c automatically, and added access to yaaw via nginx, so I can start large files download to my PC with my tablet/smartphone. So it’s another use case I did not think of at first.
Secure setup for Aria2 (not tried yet): http://ahmadly.com/en/downloader-server/
@dewet
Aria2 is MUCH better! Jdownloader is a ram hog that uses about 300MB of ram because it’s a java program when aria2 only uses under 20MB of ram. Also Jdownloader makes the folder structure kind of weird.
Hello! I want to download following document from baidu. I do not understand Chinese and moreover it needs some download points to get the full document. Can you help me to get this document?
http://wenku.baidu.com/view/8b4a85a5f524ccbff1218453.html
BaiduExporter is not signed, so Firefox 43.0 will refuse to install it as “it could not be verified”
A workaround is to set xpinstall.signatures.required to false with about:config.
Since this post was my starting point when I tried to improve download speeds from baidu cloud, here’s what I came up with:
http://www.stane1983.com/index.php/2016/07/13/how-to-download-faster-from-chinese-baidu-cloud-service-linux/
Sadly BaiduExporter is not working for me in either Firefox or Chrome anymore, so I had to install Jdownloader.
I never use baidu etc but reading this reminded me that while reading other blogs, I saw this mentioned awhile back.
github.com/yzfedora/baidudl
Not a clue if helpful or not!
@Theguyuk
I can’t see password support.
@Jean-Luc Aufranc (CNXSoft)
Sorry it is of no help then 🙁
@Theguyuk
I’ve tried it this morning, and I can confirm password does not work, so it’s basically the same as pan-baidu-download script mention in the post. I can still be useful if you want to download a file shared without password.
However, manufacturers seem to share firmware via Baidu with a password most of the time.