Skip to content

Commit

Permalink
Build V1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Evil0ctal committed Dec 19, 2022
1 parent e0aa715 commit 9545f05
Show file tree
Hide file tree
Showing 15 changed files with 666 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ __pycache__/
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/GitLink.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/TikHub_PyPi.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 98 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 84 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
| 🔜 | SOON符 - 功能已提出但尚未分配指定开发人员。|
| ⚠️ | 警告符 - 功能出现问题待修复。|

### 项目进度
## 项目进度

| 状态 | API端点路径 | 功能 |
| :---: | :---: | :---: |
Expand Down Expand Up @@ -52,6 +52,87 @@
| 🚀 | `/tiktok_profile_videos/` | 爬取用户主页视频数据 | 无已知问题 |
| 🚀 | `/tiktok_profile_liked_videos/` | 爬取用户主页已点赞视频数据 | 无已知问题 |

## 1. 制作待办事宜 `Todo` 列表
## 待办事宜 `Todo` 列表

- [ ] 🎉 修复失效端点
- [ ] ⚠️ 修复`/douyin_video_comments/`端点
- [ ] ⚠️ 修复`/douyin_music_videos/`端点

## 使用示例

```python
async def async_test() -> None:
# 异步测试/Async test

tiktok_url = 'https://www.tiktok.com/@evil0ctal/video/7156033831819037994'

tiktok_music_url = 'https://www.tiktok.com/music/original-sound-7128362040359488261'

douyin_url = 'https://www.douyin.com/video/7153585499477757192'

douyin_user_url = 'https://www.douyin.com/user/MS4wLjABAAAA-Hu1YKTuhE3QkCHD5yU26k--RUZiaoMRtpfmeid-Z_o'

print("Test start...\n")
start_time = time.time()

# 获取TikHub请求头/Get TikHub request header
print("Running test : API.authenticate()")
await api.authenticate()

# 获取TikHub用户信息/Get TikHub user information
print("Running test : API.get_user_info()")
await api.get_user_info()

print("\nRunning ALL TikTok methods test...\n")

# 获取单个视频数据/Get single video data
print("Running test : API.get_tiktok_video_data()")
await api.get_tiktok_video_data(tiktok_url)

# 获取获取用户主页的所有视频数据/Get all video data on the user's homepage
print("Running test : API.get_tiktok_profile_videos()")
aweme_list = await api.get_tiktok_profile_videos(tiktok_url, 20)
print(f'Get {len(aweme_list)} videos from profile')

# 获取用户主页的所有点赞视频数据/Get all liked video data on the user's homepage
print("Running test : API.get_tiktok_profile_liked_videos()")
aweme_list = await api.get_tiktok_profile_liked_videos(tiktok_url, 20)
print(f'Get {len(aweme_list)} liked videos from profile')

# 获取TikTok视频的所有评论数据/Get all comment data of TikTok video
print("Running test : API.get_tiktok_video_comments()")
comments_list = await api.get_tiktok_video_comments(tiktok_url, 20)
print(f'Get {len(comments_list)} comments from video')

# 获取音乐页面上的所有(理论上能抓取到的)视频数据/Get all (theoretically) video data on the music page
print("Running test : API.get_tiktok_music_videos()")
aweme_list = await api.get_tiktok_music_videos(tiktok_music_url, 20)
print(f'Get {len(aweme_list)} videos from music')

print("\nRunning ALL Douyin methods test...\n")

# 获取单个视频数据/Get single video data
print("Running test : API.get_douyin_video_data()")
await api.get_douyin_video_data(douyin_url)

# 获取获取用户主页的所有视频数据/Get all video data on the user's homepage
print("Running test : API.get_douyin_profile_videos()")
aweme_list = await api.get_douyin_profile_videos(douyin_user_url, 20)
print(f'Get {len(aweme_list)} videos from profile')

# 获取用户主页的所有点赞视频数据/Get all liked video data on the user's homepage
print("Running test : API.get_douyin_profile_liked_videos()")
aweme_list = await api.get_douyin_profile_liked_videos(douyin_user_url, 20)

# 总耗时/Total time
total_time = round(time.time() - start_time, 2)
print("\nTest completed, total time: {}s".format(total_time))


if __name__ == '__main__':
api = API(
username='test',
password='test',
proxy=None,
)
asyncio.run(async_test())
```
Binary file added dist/tikhub-1.0.0-py3-none-any.whl
Binary file not shown.
Binary file added dist/tikhub-1.0.0.tar.gz
Binary file not shown.
41 changes: 41 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# RUN Command Line:
# 1.Build-check dist folder
# python setup.py sdist bdist_wheel
# 2.Upload to PyPi
# twine upload dist/*

import setuptools

with open("README.md", "r", encoding='utf8') as fh:
long_description = fh.read()

setuptools.setup(
name='tikhub',
author='TikHub.io',
version='1.0.0',
license='Apache V2.0 License',
description='Douyin/TikTok async data scraper.',
long_description=long_description,
long_description_content_type="text/markdown",
author_email='tikhub.io@proton.me',
url='https://github.com/orgs/TikHubIO',
packages=setuptools.find_packages(),
keywords='TikTok, Douyin, 抖音, Scraper, Crawler, API, Download, Video, No Watermark, Async',
# 依赖包
install_requires=[
'aiohttp',
"tenacity",
],
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
],
python_requires='>=3.6',
)
Empty file added tikhub/__init__.py
Empty file.
Loading

0 comments on commit 9545f05

Please sign in to comment.