# -*- coding: utf-8 -*-
# @Author: wangkun
# @Time: 2023/6/13
import os
import sys
sys.path.append(os.getcwd())
from common.common import Common
from xigua.xigua_search.xigua_search_dev import XiguasearchDev


def xigua_search_main(log_type, crawler, env):
    Common.logger(log_type, crawler).info("开始抓取西瓜搜索")
    Common.logging(log_type, crawler, env, "开始抓取西瓜搜索")
    XiguasearchDev.get_search_videos(log_type=log_type,
                                     crawler=crawler,
                                     rule_dict={"play_cnt": {"min": 8000, "max": 0},
                                                "duration": {"min": 60, "max": 600},
                                                "period": {"min": 365, "max": 365},
                                                "videos_cnt": {"min": 30, "max": 0}},
                                     user_list=[{"uid": 6267141, "source": "xigua",
                                                 "link": "含嘌呤高食物一览表",
                                                 "nick_name": "含嘌呤高食物一览表",
                                                 "avatar_url": "http://rescdn.yishihui.com/user/default/avatar/live/1616555578819_u=1922778943,2660693611&fm=26&gp=0.jpg",
                                                 "mode": "search"},
                                                {"uid": 6267140, "source": "xigua",
                                                 "link": "司马南",
                                                 "nick_name": "司马南",
                                                 "avatar_url": "http://rescdn.yishihui.com/user/default/avatar/live/1616555578819_u=1922778943,2660693611&fm=26&gp=0.jpg",
                                                 "mode": "search"}
                                                ],
                                     env=env)
    Common.del_logs(log_type, crawler)
    Common.logger(log_type, crawler).info("抓取一轮结束\n")
    Common.logging(log_type, crawler, env, "抓取一轮结束\n")


if __name__ == "__main__":
    xigua_search_main("search", "xigua", "dev")
