Weibo media batch downloader
Forked from https://github.com/nondanee/weiboPicDownloader
Major improvements:
- Now can download posts with more than 9 pictures.
- Now can download HD videos.
- Cleanup text from the Weibo text content when used in name template.
- Refactored as a module for easier incorporating into other Python scripts/projects. It now returns a list of dict to show some stats from the download session too.
- Various bug fixes.
Breaking changes:
- Dropped Python 2 support (only tested with 3.8, but should work with some earlier versions too)
-b(boundary) now is NON-inclusive on the left-side (earlier date). This is done to make it easier to update (so you can use-b last_checked_bid:to only download new posts without overlapping).-bwith a specific mid/bid (instead of a range) would still download (always and only) that specific single post.
- nondanee/weiboPicDownloader (original repo, no longer maintained)
for more info about Weibo's APIs, check original repo's wiki
$ pip install requests
$ pip install colorama # only windows version under 10.0.14393 required
$ python .\weiboPicDownloader.py -h
usage: weiboPicDownloader [-h] (-u user [user ...] | -f file [file ...])
[-d directory] [-s size] [-r retry] [-i interval]
[-c cookie] [-b boundary] [-n name] [-v] [-o]
optional arguments:
-h, --help show this help message and exit
-u user [user ...] specify nickname or id of weibo users
-f file [file ...] import list of users from files
-d directory set picture saving path
-s size set size of thread pool
-r retry set maximum number of retries
-i interval set interval for feed requests
-c cookie set cookie if needed
-b boundary focus on weibos in the id range
-n name customize naming format
-v download videos together
-o overwrite existing files
Required argument (choose one)
-u user ...users (nickname or id)-f file ...user list files (nickname or id, separated by linefeed in the file)
Optional arguments
-d directorymedia saving path (default value:./weiboPic)-s sizethread pool size (default value:20)-r retrymax retries (default value:2)-i intervalrequest interval (default value:1, unit: second)-c cookielogin credential (only need the value of a certain key namedSUB)-b boundarymid/bid/date range of weibos (format:id:idbetween,:idbefore,id:after,idcertain,:all). Use@%Y%m%d(like@20220520) for date; otherwise integers would be considered as mid.-n namenaming template (identifier:url,index,type,mid,bid,date,text,name,uid, like "f-Strings" syntax)-vdownload miaopai videos at the same time-ooverwrite existing files (skipping if exists for default)
- Go to https://m.weibo.cn and log in
- Inspect > Application > Cookies > https://m.weibo.cn
- Double click the
SUBline and copy its value - Paste it into terminal and run like
-c <value>