""" @author: luojunhui """ import json import requests from applications.utils import proxy from .use_js import call_js_function def get_toutiao_account_video_list(account_id: str, cookie: str, max_behot_time=0) -> dict: """ get toutiao account video list :param account_id: toutiao account id :param cookie: cookie maybe expire not quite sure :param max_behot_time: max behot time :return: toutiao account video list """ ms_token = 'mFs9gU4FJc23gFWPvBfQxFsBRrx1xBEJD_ZRTAolHfPrae84kTEBaHQR3s8ToiLX4-U9hgATTZ2cVHlSixmj5YCTOPoVM-43gOt3aVHkxfXHEuUtTJe-wUEs%3D' query_params = [ 0, 1, 14, 'category=pc_user_hot&token={}&aid=24&app_name=toutiao_web&msToken={}'.format(account_id, ms_token), '', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36', ] a_bogus = call_js_function(query_params) url = f'https://www.toutiao.com/api/pc/list/user/feed?category=pc_profile_video&token={account_id}&max_behot_time={max_behot_time}&hot_video=0&entrance_gid=&aid=24&app_name=toutiao_web&msToken={ms_token}&a_bogus={a_bogus}' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3', 'cookie': cookie } response = requests.get(url, headers=headers, proxies=proxy()) return response.json()