84 lines
1.9 KiB
Python
84 lines
1.9 KiB
Python
# 声明:本代码仅供学习和研究目的使用。使用者应遵守以下原则:
|
|
# 1. 不得用于任何商业用途。
|
|
# 2. 使用时应遵守目标平台的使用条款和robots.txt规则。
|
|
# 3. 不得进行大规模爬取或对平台造成运营干扰。
|
|
# 4. 应合理控制请求频率,避免给目标平台带来不必要的负担。
|
|
# 5. 不得用于任何非法或不当的用途。
|
|
#
|
|
# 详细许可条款请参阅项目根目录下的LICENSE文件。
|
|
# 使用本代码即表示您同意遵守上述原则和LICENSE中的所有条款。
|
|
|
|
|
|
from enum import Enum
|
|
from typing import NamedTuple
|
|
|
|
|
|
class FeedType(Enum):
|
|
# 推荐
|
|
RECOMMEND = "homefeed_recommend"
|
|
# 穿搭
|
|
FASION = "homefeed.fashion_v3"
|
|
# 美食
|
|
FOOD = "homefeed.food_v3"
|
|
# 彩妆
|
|
COSMETICS = "homefeed.cosmetics_v3"
|
|
# 影视
|
|
MOVIE = "homefeed.movie_and_tv_v3"
|
|
# 职场
|
|
CAREER = "homefeed.career_v3"
|
|
# 情感
|
|
EMOTION = "homefeed.love_v3"
|
|
# 家居
|
|
HOURSE = "homefeed.household_product_v3"
|
|
# 游戏
|
|
GAME = "homefeed.gaming_v3"
|
|
# 旅行
|
|
TRAVEL = "homefeed.travel_v3"
|
|
# 健身
|
|
FITNESS = "homefeed.fitness_v3"
|
|
|
|
|
|
class NoteType(Enum):
|
|
NORMAL = "normal"
|
|
VIDEO = "video"
|
|
|
|
|
|
class SearchSortType(Enum):
|
|
"""search sort type"""
|
|
# default
|
|
GENERAL = "general"
|
|
# most popular
|
|
MOST_POPULAR = "popularity_descending"
|
|
# Latest
|
|
LATEST = "time_descending"
|
|
|
|
|
|
class SearchNoteType(Enum):
|
|
"""search note type
|
|
"""
|
|
# default
|
|
ALL = 0
|
|
# only video
|
|
VIDEO = 1
|
|
# only image
|
|
IMAGE = 2
|
|
|
|
|
|
class Note(NamedTuple):
|
|
"""note tuple"""
|
|
note_id: str
|
|
title: str
|
|
desc: str
|
|
type: str
|
|
user: dict
|
|
img_urls: list
|
|
video_url: str
|
|
tag_list: list
|
|
at_user_list: list
|
|
collected_count: str
|
|
comment_count: str
|
|
liked_count: str
|
|
share_count: str
|
|
time: int
|
|
last_update_time: int
|