4 Yet another automatic/semi-automatic/manual danmaku and video file downloader of Bilibili.
6 This grabber is integrated with most of the "black techs". Good to bypass some copyright and
7 geolocation restrictions:
9 * 7 independent ways to parse source(s)! Now with BilibiliPr and you-get! And fake IP!
10 * Auto concatenates and converts to MP4 (or FLV, even nothing, if not possible) file(s) via direct integration with [Mukioplayer-Py-Mac](https://github.com/cnbeining/Mukioplayer-Py-Mac) (the Flash danmaku playing solution) and [ABPlayer-HTML5-Mac](https://github.com/cnbeining/ABPlayerHTML5-Py--nix) (the HTML5 playing solution, preferred).
11 * Interactive and command line mode for different use-cases. And also silent mode.
12 * Process single or multiple videos with ease. Now you can use Bilibili *mylist*s.
13 * Convert danmaku to ASS subtitles with ease using m13253's [Danmaku2ass](https://github.com/m13253/danmaku2ass) (GPLv2).
14 Both py2 and master (py3) branches available for better danmaku handling.
16 * M3U exports -- play danmaku without waiting with players like MPlayer, MPC or VLC, etc.
17 * Built-in multi-part download, useful to reduce slow overheads.
22 If you have a Bilibili account, setting the cookie with [dantmnf/biliupload/getcookie.py](https://github.com/dantmnf/biliupload/blob/master/getcookie.py) will help you to download some of the restricted videos. You can do this by hand too.
24 The file should look like:
26 DedeUserID=123456;DedeUserID__ckMd5=****************;SESSDATA=*******************
28 Interactive mode (Note some functionalities are not available in this mode):
34 $ python2 biligrab.py -h
35 python biligrab.py (-h) (-a) (-p) (-s) (-c) (-d) (-v) (-l) (-e) (-b) (-m) (-n) (-u) (-t) (-q) (-r) (-g)
38 Print this usage file.
42 If not set, Biligrab will use the fallback interactive mode.
43 Support "~", "," and mix use.
53 Able to use the same syntax as "-a".
54 If set to 0, Biligrab will download all the available parts in the video.
58 0: The original API source, can be Letv backup,
59 and can fail if the original video is not available(e.g., deleted)
60 1: The CDN API source, "oversea accelerate".
61 Can be MINICDN backup in Mainland China or oversea.
62 Good to bypass some bangumi's restrictions.
63 2: Force to use the original source.
64 Use Flvcd to parse the video, but would fail if
65 1) The original source DNE, e.g., some old videos
66 2) The original source is Letvcloud itself.
67 3) Other unknown reason(s) that stops Flvcd from parsing the video.
68 For any video that failed to parse, Biligrab will try to use Flvcd.
69 (Mainly for oversea users regarding to copyright-restricted bangumies.)
70 If the API is blocked, Biligrab would fake the UA.
71 3: (Not stable) Use the HTML5 API.
72 This works for downloading some cached Letvcloud videos, but is slow, and would fail for no reason sometimes.
73 Will retry if unavailable.
75 Good to fight with oversea and copyright restriction, but not working with iQiyi.
76 May retrieve better quality video, especially for Youku.
78 Good to fight with some copyright restriction that BilibiliPr can fix.
79 Not always working though.
80 6: Use You-get (https://github.com/soimort/you-get).
81 You need a you-get callable directly like "you-get -u blahblah".
83 -c: Default: ./bilicookies
85 Use cookies to visit member-only videos.
88 Set the desired download software.
89 Biligrab supports aria2c(16 threads), axel(20 threads), wget and curl by far.
90 If not set, Biligrab will detect an available one;
91 If none of those is available, Biligrab will quit.
92 For more software support, please open an issue at https://github.com/cnbeining/Biligrab/issues/
95 Set the desired concatenate software.
96 Biligrab supports ffmpeg by far.
97 If not set, Biligrab will detect an available one;
98 If none of those is available, Biligrab will quit.
99 For more software support, please open an issue at https://github.com/cnbeining/Biligrab/issues/
100 Make sure you include a *working* command line example of this software!
103 Dump the log of the output for better debugging.
107 Export Danmaku to ASS file.
108 Fulfilled with danmaku2ass(https://github.com/m13253/danmaku2ass/tree/py2),
109 Author: @m13253, GPLv3 License.
110 *For issue with this function, if you think the problem lies on the danmaku2ass side,
111 please open the issue at both projects.*
112 If set to 1 or 2, Biligrab will use Danmaku2ass's py2 branch.
113 If set to 3, Biligrab will use Danmaku2ass's master branch, which would require
114 a python3 callable via 'python3'.
115 If python3 not callable or danmaku2ass2/3 DNE, Biligrab will ask for action.
118 Set the probe software.
119 Biligrab supports Mediainfo and FFprobe.
120 If not set, Biligrab will detect an available one;
121 If none of those is available, Biligrab will quit.
122 For more software support, please open an issue at https://github.com/cnbeining/Biligrab/issues/
123 Make sure you include a *working* command line example of this software!
126 Only download the danmaku.
130 Biligrab will not ask any question.
133 Export video link to .m3u file, which can be used with MPlayer, mpc, VLC, etc.
134 Biligrab will export a m3u8 instead of downloading any video(s).
135 Can be broken with sources other than 0 or 1.
138 The number of Mylist.
139 Biligrab will process all the videos in this list.
142 The thread number for downloading.
143 Good to fix overhead problem.
146 Select video quality.
147 Only works with Source 0 or 1.
148 Range: 0~4, higher for better quality.
151 Threads for downloading every part.
152 Works with aria2 and axel.
161 - curl + None/aria2c/wget/axel
163 - mediainfo/ffprobe (for danmaku2ass)
164 - Python 3.x (for danmaku2ass's python3 mode, or you-get)
165 - you-get (See https://github.com/soimort/you-get for mode 6 info.)
169 Beining, http://www.cnbeining.com/
176 The Danmaku2ass(master) and Danmaku2ass(py2) part belongs to @m13253, GPLv3 license. Used under the authorization of the original author.
178 This program is provided **as is**, with absolutely no warranty.
183 Any contribution are welcome.
185 For issues, it would be better to include the log output, which can be enabled by `-l`.
187 MAKE SURE YOU DELETE ANY SENSITIVE INFORMATION THAT YOU DO NOT WANT TO SHARE PUBLICLY (E.G., IP ADDRESS, USERNAME, ETC.) BEFORE YOU POST ANYTHING!
189 *You can still send me the info privately via my email. PGP public key available at http://www.cnbeining.com/about/*
191 Any donation is welcome as well. Please get in touch with me: cnbeining[at]gmail.com .
195 0.98.95: Use the miniloader's key.
197 0.98.92: Again change API key set.
199 0.98.91: Change API key set.
201 0.98.86: Emergency update: Fake UA to download.
203 0.98.85: Rewrite url get function, also add IP faking.
205 0.98.81: Update as API domain update. Thanks for @m13253 's help.
207 0.98.8: Add download via you-get; Fix traceback printing.
209 0.98.72: Add thread control, as in #15 .
211 0.98.7: Add some quality selection.
213 0.98.6: Add BilibiliPr's API.
215 0.98.5: Add testing multi-part download, Change UA, Change error handling, Fix #13, #14.
217 0.98.4: Change UA, change to use best source, rewrite HTML5 API as in #11.
219 0.98.39: Change to download high quality Youku video, rewrite the error report and logging, retry if failed to fetch video, rewrite arguments.
221 0.98.3: Change default probe software to ffprobe; Fix error at resolution with danmaku export only; Better debugging output; Fix error with danmaku2ass(py2)'s float problem; Beautify code.
223 0.98.29: Add ver. number: Fix: do not fail to fake UA when use normal api #9, thanks to @arition 's help.
225 0.98.28: Fix typo; Fix error with CLI mode.
227 0.98.27: Update as #7.
229 0.98.26: Add more support of broken sources.
231 0.98.25: Add **some** support of M3U export of Sina source and source that was broken.
233 0.98.2: Add **some** support of M3U export of non-Sina source.
235 0.98.1: Add mylist download.
237 0.98: Fix error with special characters in filename; Add export to M3U file to use players like MPlayer, VLC, etc.; Rewrite video URL API logic; Fix error with Danmaku2ASS(main); Error handling with ffprobe
239 0.97.9: Rewrite URL retrieve logic; Divide URL retrieve to functions; Change to ```.format()``` style; Add HTML5 API; Directly use Flvcd; Beautify ERROR logging.
241 0.97.5: Add (auto) download all the pages; Auto PEP-8.
243 0.97: Silent mode; Multiple video mode; Functions beautify; More error handling.
245 0.96.2: Merge pull request #6, #7: Optimize Danmaku2ASS parameters and exception handling, thanks to @m13253's help; Fix error when cookie does not exist, thanks to @m13253's report.
247 0.96.1: Add exception handling regarding to Danmaku2ass2; Fix vid guessing.
249 0.96: Add danmaku2ass(py2) to handle ass convertion without Python 3; Add the danmaku2ass dependencies check mode for safety; Add "danmaku only" mode to depreciate BiligrabLite; Change the default live time to 8 sec as the update from upstream; Update the license info.
251 0.95: Add danmaku2ass, able to convert danmaku to ass file; Fix axel error.
253 0.94: Add faking UA to bypass blocking; Add auto-generate UA; Rewrite API logic.
255 0.93: Fix error when handling filenames containing ```/\&```, thanks to @solimot 's report; Add log mode, which can be enabled by ```-l 1 ```; Clean multiple headers; Rearrange global variables.
257 0.92: Fix wrongly exit when downloading multiple parts.
259 0.91: Add support to axel, wget, curl and easy way to add more support; Add easy way to add more concat support; Able to select desired software and auto detect; Change dependencies check; Code beauty.
261 0.90: Fix if cannot get download URL for some reason(geo location, or API server error), try to use Flvcd to download video.
263 0.89: Fix #4, force declare the variable, and set the path if not assigned.
265 0.88: Fix #3, 2 typos.
267 0.87: Able to edit cookie path. Fix cannot read cookie.
269 0.86: Add non-interact mode, change API domain, fix #2.
271 0.81: Fix Flvcd module; When failed to concat, try to concat to flv; If failed, leave the original file; Delete some lines to make it easier to intregrate; Fix domain name
273 0.8: Fix the most recent change with APIs, with player biliInterface-201407302359. Use own key instead of AcDown's.
275 For history before V0.74, visit http://www.cnbeining.com/ , or check the code at https://gist.github.com/cnbeining/9605757/revisions .