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.

@ma2za ma2za closed this Dec 21, 2025
@ma2za
Copy link
Owner

ma2za commented Dec 21, 2025

Hi, i merged the part regarding custom_domain_optional, please let me know if it works fine, still don't understand that field. the cookie part i don't think is necessary. I also just added a cookie string field which makes them easier to pass as an env var @SajjadKiani

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