Skip to content

[Fix] magnetdl error 404 when search string contains a special character#3644

Merged
paranoidi merged 2 commits intoFlexget:developfrom
trananhtuan:fix_magnetdl_search
Dec 27, 2022
Merged

[Fix] magnetdl error 404 when search string contains a special character#3644
paranoidi merged 2 commits intoFlexget:developfrom
trananhtuan:fix_magnetdl_search

Conversation

@trananhtuan
Copy link
Copy Markdown
Contributor

Motivation for changes:

magnetdl search returns error 404 every time the search term contains a special character because magnetdl.com search path can only contains [a-z0-9] and slashes/-. Current implementation is not good enough.

Detailed changes:

  • Unicode characters are normalized to ASCII first before all invalid chars are stripped to construct a valid search URL
  • For example, search term "Pépé le Moko (1937)" should now be constructed as https://www.magnetdl.com/p/pepe-le-moko-1937

Log and/or tests output (preferably both):

Magnetdl.com should return 200 even when there is no matches but it returns error 404 due to malform URLs

2022-12-27 12:44:24 WARNING  magnetdl      download-movie-queue Url https://www.magnetdl.com/s/sample-movie-(2001)/ returned 404
2022-12-27 12:44:23 WARNING  magnetdl      download-movie-queue Url https://www.magnetdl.com/p/p<C3><A9>p<C3><A9>-le-moko-(1937)/ returned 404
2022-12-27 12:44:20 WARNING  magnetdl      download-movie-queue Url https://www.magnetdl.com/y/you-&-i/ returned 404

@paranoidi paranoidi merged commit 5249dbc into Flexget:develop Dec 27, 2022
@paranoidi
Copy link
Copy Markdown
Member

thanks!

@yukatapangolin
Copy link
Copy Markdown

I'm getting "name 'unicodedata' is not defined" errors. I think there's a missing import unicodedata at the top

@trananhtuan trananhtuan deleted the fix_magnetdl_search branch January 3, 2023 10:02
@trananhtuan trananhtuan restored the fix_magnetdl_search branch January 3, 2023 10:02
@trananhtuan
Copy link
Copy Markdown
Contributor Author

good catch, thanks

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.

3 participants