Weibo trending posts scraper
Project description
Weibo trending posts scraper
Scrap trending posts from Weibo front page.
Usage guide
As a library
Install
pip install weibo-trending
Get and parse posts
from weibo_trending import get_new_posts, parse_response
resp = get_new_posts()
mblogs = parse_response(resp)
for mblog in mblogs:
print(mblog)
As a command line tool
Install
pip install weibo-trending
Usage
python -m weibo_trending --help
usage: weibo_trending [-h] [-d DIR] [-s]
Scrape and parse Weibo trending posts.
optional arguments:
-h, --help show this help message and exit
-d DIR, --dir DIR specify the output directory. Defaults to the current working directory
-s, --skip-parsing whether to skip parsing and dump the raw JSON response from Weibo
python -m weibo_trending
weibo_trending will save each scraped post with the following filename format:
weibo_<user ID>_<post ID>.json
- Example:
weibo_1631153043_4834313265233660.json
Each call to weibo_trending usually saves 10 new files. If you get fewer than 10, that means the response contains one or more deleted posts. They are not saved.
Develop
git clone https://github.com/ericlingit/weibo-trending.git
cd weibo-trending
python3 -m venv venv
source venv/bin/activate
pip install -U pip wheel
pip install -r requirements.txt
pip install -e .
pytest
Package
python -m build --wheel
The built wheel is in ./dist/
.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
weibo_trending-0.0.3.tar.gz
(49.6 kB
view details)
Built Distribution
File details
Details for the file weibo_trending-0.0.3.tar.gz
.
File metadata
- Download URL: weibo_trending-0.0.3.tar.gz
- Upload date:
- Size: 49.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06489f01ff91e6516231f31032153e00798dc823db041f191fc08900777981e0 |
|
MD5 | df76bfec9441851572ec2197a5cd095f |
|
BLAKE2b-256 | 4adb5f03703099ef1bf0e410375f786c3759cffffbaad121067d4859504883ba |
File details
Details for the file weibo_trending-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: weibo_trending-0.0.3-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee1477d4607bea09f95c5a38e4d535472797abf2dc7d0bc207aeebbf188f1c78 |
|
MD5 | 33d08430802275faec157dcdb14e3107 |
|
BLAKE2b-256 | dd1ad5902aeda880fc5ff03fd88ffcf38ad4dc60888bda4e3d61345f10a9c33d |