| | |
| | | import asyncio |
| | | import sys |
| | | from datetime import datetime |
| | | from auto_media_publisher.utils.uploader_helper import create_and_run_uploader |
| | | from auto_media_publisher.utils.uploader_helper import create_media_uploader |
| | | from auto_media_publisher.utils.utils_file import load_json |
| | | |
| | | async def main(): |
| | | if len(sys.argv) < 3: |
| | | print("python test_upload.py [PLATFORM] [JSON_PATH] ") |
| | | print("python test_upload.py douyin medias/user01/test.json") |
| | | print("douyin, kuaishou, shipinhao, xiaohongshu, bilibili, baijiahao, tiktok, twitterX, all") |
| | | print("python test_upload.py [user] [PLATFORM] [proxy] [JSON_PATH] ") |
| | | print("python test_upload.py 18918594752 xiaohongshu None data/video_final/18918594752bukebuke/test.json") |
| | | print("[PLATFORM] douyin, kuaishou, shipinhao, xiaohongshu, bilibili, baijiahao, tiktok, twitterX, all") |
| | | return |
| | | #test_video_json = "medias/user01/test.json" |
| | | proxy=None |
| | | #proxy="http://127.0.0.1:7890" |
| | | |
| | | await create_and_run_uploader(platform=sys.argv[1],json_data=load_json(sys.argv[2]),proxy=proxy) |
| | | handler = await create_media_uploader(user=sys.argv[1],platform=sys.argv[2],proxy=sys.argv[3]) |
| | | await handler.upload(load_json(sys.argv[4])) |
| | | |
| | | if __name__ == "__main__": |
| | | asyncio.run(main()) |
| | | |
| | | """ |
| | | if __name__ == '__main__': |
| | | user="user01" |
| | | title = "test_video" |
| | | tags=["你好","不知都"] |
| | | path_video = "medias/user01/demo.mp4" |
| | | path_cover = "medias/user01/demo.png" |
| | | publish_datetime = datetime.strptime("2025-05-02 22:00", "%Y-%m-%d %H:%M") |
| | | localtion = "上海市" |
| | | proxy="http://127.0.0.1:7890" |
| | | class_type="动物" |
| | | #app = UploaderDouyin(user,title, path_video, tags, publish_datetime, localtion,path_cover) |
| | | #app = UploaderKuaishou(user,title, path_video, tags, publish_datetime, localtion,path_cover) |
| | | #app = UploaderXiaohongshu(user,title, path_video, tags, publish_datetime, localtion,path_cover) |
| | | #app = UploaderBaijiahao(user,title, path_video, tags, publish_datetime, localtion,path_cover) |
| | | #app = UploaderShipinhao(user,title, path_video, tags, publish_datetime, localtion,path_cover) |
| | | #app = UploaderBilibili(user,title, path_video, tags, publish_datetime, localtion,path_cover) |
| | | #app = UploaderTiktok(user,title, path_video, tags, publish_datetime, localtion,path_cover,proxy) |
| | | app = UploaderTwitterX(user,title, path_video, tags, publish_datetime, localtion,path_cover,proxy) |
| | | |
| | | success = asyncio.run(app.run()) |
| | | """ |
| | | asyncio.run(main()) |