import os import sys sys.path.append(os.path.dirname(os.path.dirname(__file__))) from douyin.flow import check_page from dp.page import page from conf.config import logger,OUTPUT from database.config import minio_block from database.s3 import S3Object,S3 from database.config import minio_client from pathlib import Path from douyin import chat_test tab=page.tab def save_html_to_s3(): file_name = '点击陌生人对话框.html' page_dir = Path(r'I:\code\ai-yunying\live-online-people\output\page\\') file_path = page_dir/file_name f = open(file_path, 'w') f.write(tab.html) s3minio = S3(bucket='public',client=minio_client) base_path = '/md/ai-yunying/' obj_name = base_path+ s3minio.get_object_name_by_time() + '-'+ file_name res = s3minio.fput(r'I:\code\ai-yunying\live-online-people\output\page\\'+file_name, obj_name) logger.info(f"{res.bucket_name } {res.object_name} {res._http_headers}") def check_msg(): from douyin.flow import conversation,unread_msg def main(): chat_test.Chat() # save_html_to_s3() # res = minio_client.fput_object(bucket_name='public', object_name=base_path+file_name, file_path=r"I:\code\ai-yunying\live-online-people\output\page\\"+file_name,content_type= 'text/html') # ele_dlg = tab.ele('xpath://div[@data-e2e="listDlg-container"]') # logger.info(f"{ele_dlg.text}") # check_has_im_msg_flow(home_url="https://www.douyin.com/user/self") # S3Object(path='runtime/check_msg-stranger-msg.html').put(tab.html) # f = open(r'I:\code\ai-yunying\live-online-people\output\page\点击陌生人消息.html', 'w') # f.write(tab.html) if __name__ == "__main__": main()