Skip to content

Conversation

SajjadKiani
Copy link

@SajjadKiani SajjadKiani commented Apr 25, 2025

i add the "cookie_session" for bypass the captcha and fix some issue with substack changes

@SajjadKiani SajjadKiani deleted the cookie-auth branch April 25, 2025 17:19
@SajjadKiani SajjadKiani restored the cookie-auth branch April 25, 2025 17:20
@SajjadKiani SajjadKiani deleted the cookie-auth branch April 25, 2025 17:21
@SajjadKiani SajjadKiani restored the cookie-auth branch April 25, 2025 17:21
@SajjadKiani SajjadKiani reopened this Apr 25, 2025
substack/api.py Outdated
if not custom_domain:
publication_url = f"https://{publication['subdomain']}.substack.com"
else:
if publication['custom_domain_optional']:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a get to avoid KeyError for the custom_domain_optional key

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i fix this issue in this commit

super().__init__()
with open(cookie_file, "r", encoding="utf-8") as f:
raw = json.load(f)
self.cookies = cookiejar_from_dict({c["name"]: c["value"] for c in raw})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this fully replace the cookies with the content of the json file? if so then it is should update the cookies dict instead of replacing it in order to not break the behavior of

self._session.cookies.update(cookies)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s true, so I removed CookieSession.py (it was no longer needed) and updated the cookie-session instance instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants