Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/python3webspider/douyin
API of DouYin for Humans used to Crawl Popular Videos and Musics
https://github.com/python3webspider/douyin
crawler douyin spider videos
Last synced: 5 days ago
JSON representation
API of DouYin for Humans used to Crawl Popular Videos and Musics
- Host: GitHub
- URL: https://github.com/python3webspider/douyin
- Owner: Python3WebSpider
- License: mit
- Created: 2018-10-24T06:44:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-29T03:33:36.000Z (about 5 years ago)
- Last Synced: 2025-01-21T07:05:04.045Z (12 days ago)
- Topics: crawler, douyin, spider, videos
- Language: Python
- Homepage:
- Size: 574 KB
- Stars: 648
- Watchers: 34
- Forks: 260
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
注:项目已不可用...
# DouYin
API of DouYin App for humans.
## Installation
```
pip3 install douyin
```## Usage
Here is the sample code:
```python
import douyin
from douyin.structures import Topic, Music# define file handler and specify folder
video_file_handler = douyin.handlers.VideoFileHandler(folder='./videos')
music_file_handler = douyin.handlers.MusicFileHandler(folder='./musics')
# define mongodb handler
mongo_handler = douyin.handlers.MongoHandler()
# define downloader
downloader = douyin.downloaders.VideoDownloader([mongo_handler, video_file_handler, music_file_handler])for result in douyin.hot.trend():
for item in result.data:
# download videos of topic/music for 100 max per
downloader.download(item.videos(max=100))
```then you can get:
```
Item >
Processing > ...
Processing > ...
...
Processing > ...
Processing > ...
0%| | 0/10 [00:00, ?it/s]
Processing 1-10 of files
Processing > ...
Saving > to mongodb...
Processing > ...
Saving > to mongodb...
Processing > ...
....
Downloading > ...
Saved > to mongodb successfully
Downloading > ...
Saved > to mongodb successfully
Downloading > ...
Downloaded file to ./videos/6580510322468064526.mp4
10%|████▌ | 1/10 [00:01<00:16, 1.84s/it]
Downloaded file to ./videos/6516746291806997763.mp4
20%|█████████▏ | 2/10 [00:01<00:10, 1.33s/it]
Downloaded file to ./videos/6600742831352974596.mp4
40%|██████████████████▍ | 4/10 [00:02<00:05, 1.03it/s]
Downloaded file to ./videos/6484393014599879950.mp4
50%|███████████████████████ | 5/10 [00:02<00:04, 1.15it/s]
Downloaded file to ./videos/6616517521098935565.mp4
60%|███████████████████████████▌ | 6/10 [00:03<00:03, 1.27it/s]
Downloaded file to ./videos/6479958542747962637.mp4
70%|████████████████████████████████▏ | 7/10 [00:03<00:01, 1.68it/s]
Downloaded file to ./videos/6472305134377372941.mp4
80%|████████████████████████████████████▊ | 8/10 [00:03<00:00, 2.05it/s]
Downloaded file to ./videos/6562690160868199693.mp4
90%|█████████████████████████████████████████▍ | 9/10 [00:04<00:00, 2.27it/s]
Downloaded file to ./videos/6500385230921141518.mp4
100%|█████████████████████████████████████████████| 10/10 [00:04<00:00, 2.33it/s]
```![](https://ws2.sinaimg.cn/large/006tNbRwgy1fwmad1yh6wj30lf0p3aaf.jpg)
![](https://ws3.sinaimg.cn/large/006tNbRwly1fwo1ystiraj30lg0e3gm0.jpg)
![](https://ws3.sinaimg.cn/large/006tNbRwly1fwo20dbzduj30lg0e3q49.jpg)
![](https://ws2.sinaimg.cn/large/006tNbRwly1fwo21zyfkyj30jm0m175e.jpg)
## Examples
See [examples](./examples)