liufuhua007

add cookie uploader

...@@ -57,7 +57,7 @@ async def main(): ...@@ -57,7 +57,7 @@ async def main():
57 if args.publish_type == 1 and not args.schedule: 57 if args.publish_type == 1 and not args.schedule:
58 parser.error("The schedule must must be specified for scheduled publishing.") 58 parser.error("The schedule must must be specified for scheduled publishing.")
59 59
60 - account_file = Path(BASE_DIR / "cookies" / f"{args.platform}_{args.account_name}.json") 60 + account_file = Path(BASE_DIR / "cookies" / f"{args.platform}_uploader" / f"{args.platform}_{args.account_name}.json")
61 account_file.parent.mkdir(exist_ok=True) 61 account_file.parent.mkdir(exist_ok=True)
62 62
63 print(account_file) 63 print(account_file)
......
...@@ -35,6 +35,7 @@ async def cookie_auth(account_file): ...@@ -35,6 +35,7 @@ async def cookie_auth(account_file):
35 35
36 async def sohu_setup(account_file, handle=False): 36 async def sohu_setup(account_file, handle=False):
37 account_file = get_absolute_path(account_file, "sohu_uploader") 37 account_file = get_absolute_path(account_file, "sohu_uploader")
38 + sohu_logger.info("account_file: {}".format(account_file))
38 if not os.path.exists(account_file) or not await cookie_auth(account_file): 39 if not os.path.exists(account_file) or not await cookie_auth(account_file):
39 if not handle: 40 if not handle:
40 return False 41 return False
...@@ -49,7 +50,7 @@ async def get_sohu_cookie(account_file): ...@@ -49,7 +50,7 @@ async def get_sohu_cookie(account_file):
49 'args': [ 50 'args': [
50 '--lang en-GB' 51 '--lang en-GB'
51 ], 52 ],
52 - 'headless': True, # Set headless option here 53 + 'headless': False, # Set headless option here
53 } 54 }
54 # Make sure to run headed. 55 # Make sure to run headed.
55 browser = await playwright.chromium.launch(**options) 56 browser = await playwright.chromium.launch(**options)
......