Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix rutracker compatibility #92

wants to merge 1 commit into from

Conversation

sormy
Copy link

@sormy sormy commented Feb 22, 2025

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.

@idlesign idlesign self-requested a review February 23, 2025 03:31
@@ -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'}
Copy link
Owner

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 is win-1251-urlencoded). Yet, it's strange they'd started to verify the value.
  • Also redirect parameter should be just fine.

Copy link
Author

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.

Copy link
Owner

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 вход.

Copy link
Author

@sormy sormy Mar 3, 2025

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.

@sormy
Copy link
Author

sormy commented Mar 3, 2025

This is incomplete fix, download link doesn't work with "Unable to get torrent from"

The page it navigates to is "Just a moment..."

@sormy
Copy link
Author

sormy commented Mar 3, 2025

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).

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

Successfully merging this pull request may close these issues.

None yet

2 participants