""" @author: luojunhui """ import hashlib from datetime import datetime, timedelta import requests def generate_daily_strings(start_date, end_date): """ Generate daily date_str :param start_date: :param end_date: :return: """ start = datetime.strptime(start_date, "%Y%m%d") end = datetime.strptime(end_date, "%Y%m%d") current = start date_strings = [] while current <= end: date_strings.append(current.strftime("%Y%m%d")) current += timedelta(days=1) return date_strings def whisper(video_id): """ input video_id, output video_text :param video_id: :return: """ url = "http://61.48.133.26:5999/video_to_text" body = { "video_id": video_id } header = { "Content-Type": "application/json", } response = requests.post( url=url, json=body, headers=header ) return response.json() def get_text(video_id): """ input video_id, output video_text :param video_id: :return: """ url = "http://localhost:8888/get_text" body = { "vid": video_id } header = { "Content-Type": "application/json", } response = requests.post( url=url, json=body, headers=header ) return response.json() def hash_title(title): """ hash map :param title: :return: """ # 创建md5哈希对象 hash_object = hashlib.md5() # 对标题进行编码 title_bytes = title.encode('utf-8') # 更新哈希对象 hash_object.update(title_bytes) # 获取十六进制形式的哈希值 hash_hex = hash_object.hexdigest() return hash_hex