fix(export_douyin_cookie): read USERNAME from os.environ in embedded python
The shell passed USERNAME as an environment variable to the embedded python heredoc (USERNAME=$USERNAME python3 ...), but the python block referenced USERNAME as if it were already a local variable. The result was NameError on every run, so the export script could never produce a cookies/<platform>_<account>.json file.
Fix: read the env var explicitly with os.environ.get('USERNAME', '') at the top of the embedded block, then use the local USERNAME as before.
This commit is contained in:
@@ -52,6 +52,9 @@ import os
|
|||||||
import uuid
|
import uuid
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
# Shell 把 USERNAME 作为环境变量传过来, Python 需要显式取
|
||||||
|
USERNAME = os.environ.get('USERNAME', '')
|
||||||
|
|
||||||
DEBUG_PORT = 9222
|
DEBUG_PORT = 9222
|
||||||
if USERNAME:
|
if USERNAME:
|
||||||
COOKIE_FILE = f"cookies/douyin_{USERNAME}.json"
|
COOKIE_FILE = f"cookies/douyin_{USERNAME}.json"
|
||||||
|
|||||||
Reference in New Issue
Block a user