You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,16 +22,19 @@ Set the following environment variables by creating a **.env** file:
22
22
23
23
EMAIL=
24
24
PASSWORD=
25
+
PUBLICATION_URL= # Optional: your publication URL
26
+
COOKIES_PATH= # Optional: path to cookies JSON file
27
+
COOKIES_STRING= # Optional: cookie string for authentication
25
28
26
29
## If you don't have a password
27
30
28
-
Recently Substack has been setting up new accounts without a password. If you sign-out and sign back in it just uses
31
+
Recently Substack has been setting up new accounts without a password. If you signout and sign back in, it just uses
29
32
your email address with a "magic" link.
30
33
31
34
Set a password:
32
35
33
-
- Sign-out of Substack
34
-
- At the sign-in page click, "Sign in with password" under the `Email` text box
36
+
- Signout of Substack
37
+
- At the sign-in page, click "Sign in with password" under the `Email` text box
35
38
- Then choose, "Set a new password"
36
39
37
40
The .env file will be ignored by git but always be careful.
@@ -51,11 +54,12 @@ from substack.post import Post
51
54
api = Api(
52
55
email=os.getenv("EMAIL"),
53
56
password=os.getenv("PASSWORD"),
57
+
publication_url=os.getenv("PUBLICATION_URL"),
54
58
)
55
59
56
60
user_id = api.get_user_id()
57
61
58
-
# Switch Publications - The library defaults to your users primary publication. You can retrieve all your publications and change which one you want to use.
62
+
# Switch Publications - The library defaults to your user's primary publication. You can retrieve all your publications and change which one you want to use.
To get a cookie string, after login, go to dev tools (F12), network tab, refresh and find one of the requests like subscription/unred/subscriptions, right click and copy as fetch (Node.js), paste somewhere and get the entire cookie string assigned to the cookie header and put it in the env variables as COOKIES_STRING, et voila!
0 commit comments