Toggle navigation
Toggle navigation
This project
Loading...
Sign in
LiuFuhua
/
xj-marketing
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
liufuhua007
2024-12-24 17:17:23 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2c9ba9b097e23cd2e83149c1be76923bf9a89fb3
2c9ba9b0
1 parent
da3007c5
add cookie uploader
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
cli_main.py
uploader/sohu_uploader/main.py
cli_main.py
View file @
2c9ba9b
...
...
@@ -57,7 +57,7 @@ async def main():
if
args
.
publish_type
==
1
and
not
args
.
schedule
:
parser
.
error
(
"The schedule must must be specified for scheduled publishing."
)
account_file
=
Path
(
BASE_DIR
/
"cookies"
/
f
"{args.platform}_{args.account_name}.json"
)
account_file
=
Path
(
BASE_DIR
/
"cookies"
/
f
"{args.platform}_
uploader"
/
f
"{args.platform}_
{args.account_name}.json"
)
account_file
.
parent
.
mkdir
(
exist_ok
=
True
)
print
(
account_file
)
...
...
uploader/sohu_uploader/main.py
View file @
2c9ba9b
...
...
@@ -35,6 +35,7 @@ async def cookie_auth(account_file):
async
def
sohu_setup
(
account_file
,
handle
=
False
):
account_file
=
get_absolute_path
(
account_file
,
"sohu_uploader"
)
sohu_logger
.
info
(
"account_file: {}"
.
format
(
account_file
))
if
not
os
.
path
.
exists
(
account_file
)
or
not
await
cookie_auth
(
account_file
):
if
not
handle
:
return
False
...
...
@@ -49,7 +50,7 @@ async def get_sohu_cookie(account_file):
'args'
:
[
'--lang en-GB'
],
'headless'
:
Tru
e
,
# Set headless option here
'headless'
:
Fals
e
,
# Set headless option here
}
# Make sure to run headed.
browser
=
await
playwright
.
chromium
.
launch
(
**
options
)
...
...
Please
register
or
login
to post a comment