-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix rutracker compatibility #92
base: master
Are you sure you want to change the base?
Conversation
@@ -22,7 +22,7 @@ def get_id_from_link(self, url: str) -> str: | |||
|
|||
def get_login_form_data(self, login: str, password: str) -> dict: | |||
"""Returns a dictionary with data to be pushed to authorization form.""" | |||
return {'login_username': login, 'login_password': password, 'login': 'pushed', 'redirect': 'index.php'} | |||
return {'login_username': login, 'login_password': password, 'login': '%E2%F5%EE%E4'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Let's try to set
login
directly toвход
value (%E2%F5%EE%E4
iswin-1251
-urlencoded). Yet, it's strange they'd started to verify the value. - Also
redirect
parameter should be just fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I captured the login form data using Safari's inspector on a Mac. The login value is provided as-is, and no redirect field was present. Using "вход" in UTF-8 likely won't work if the backend expects CP1251, and hardcoding CP1251 into a Python script that defaults to UTF-8 doesn't seem ideal. Of course, utf8 вход can be converted into cp1251 before encoding into form but this would inflate code size for no good reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and no redirect field was present.
I suspect this can be related to a referer
header. Anyway, if this param breaks nothing I propose leaving in intact.
but this would inflate code size for no good reason.
Then we need at least a hint near that value: a hint about cp1251 вход
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redirect is dead code these days, misleading that it is being used. Let me know if you still think that it should remain in codebase.
This is incomplete fix, download link doesn't work with "Unable to get torrent from" The page it navigates to is "Just a moment..." |
I have updated implementation, verified end to end, can login and download links. Also fixed tests. No very confident regarding github action configuration - reference to coveralls looks dead and unused, also not sure what coverage report is needed (what to print on stdout). |
Rutracker support has stopped recently with 403. The fix is trivial - update login form content to match new version.
In addition to that, cloudflare is breaking the process, so have to pull cloudscraper that helps to avoid being detected as robot.
Also fixed tox configuration (verified to pass on 3.9-3.13 pythons on Mac).
Github integration is not tested, best effort fix.