ADD file via upload

master
ptjqfmxk9 3 years ago
parent 9ecbe989d6
commit ba3b6b647e

@ -0,0 +1,47 @@
# coding:utf-8
import requests
import redis
import time
import yaml
def read_redis_yaml():
f = open(r'./redis.yml')
data = yaml.load(f, Loader=yaml.FullLoader)
return data
redis_data = read_redis_yaml()
redis_host = redis_data['host']
redis_port = redis_data['port']
redis_password = redis_data['password']
redis_db = redis_data['db']
redis_pool = redis.ConnectionPool(host=redis_host, port=redis_port, password=redis_password, db=redis_db)
r = redis.Redis(connection_pool=redis_pool)
# 获取当前时间戳
def get_time_stamp():
return int(time.time())
def get_weibomv_url(uid, cursor, hd):
cookie = r.get('weibo_cookie')
cursor += 1
url = f'https://weibo.com/ajax/profile/getWaterFallContent?uid={uid}&cursor={cursor}'
# print(url)
headers = {
'Cookie': cookie,
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest'}
content = requests.get(url, headers=headers).json()
# print(content)
w100w = content['data']['list'][0]['page_info']['media_info']['playback_list'][hd]['play_info']['url']
# print(w100w)
w100w = w100w.replace('http://', 'https://')
cursor -= 1
return w100w
# if __name__ == '__main__':
# get_weibomv_url(1239246050, 4720854242429953, 0)
Loading…
Cancel
Save