moogar0880 / PyTrakt

A Pythonic interface to the Trakt.tv REST API
Other
66 stars 51 forks source link

slugify() function of PyTrakt seems to not rename exactly as Trakt does #165

Open typhoe opened 2 years ago

typhoe commented 2 years ago

Hi,

this issue is a follow up from an issue I have on PlexTraktSync available here: https://github.com/Taxel/PlexTraktSync/issues/615

Two examples of shows that are not slugified correctly: https://trakt.tv/shows/re-zero-starting-life-in-another-world https://trakt.tv/shows/so-i-m-a-spider-so-what

I will quote the collaborator from PlexTraktSync:

On RE-Zero:

That's a very specific issue because of this show's name using - symbol : Re:ZERO -Starting Life in Another World- The trailing dash has been removed in Trakt slug version : re-zero-starting-life-in-another-world whereas the pytrakt module does not remove it with its own slugify() function : re-zero-starting-life-in-another-world- so it doesn't match and trakt API returns 404 error.

On So-I'm-a-spider:

it's the i'm slugified into im by PyTrakt module and into i-m in trakt database. It's clearly a problem in slugify() function of PyTrakt module. It does not slugify exactly as official trakt.tv does.

Thank you

glensc commented 2 years ago

Are you willing to provide a fix?

The current slugify is defined here:

glensc commented 2 years ago

ps: edit your issue and use backticks for title, so it's better visible when rendered:

`some text inside backticks`
typhoe commented 2 years ago

Hi, I added the backticks for readability but I'm sorry but I won't be able to provide any fix. I only used a workaround to bypass the issue on PlexTraktSync.

glensc commented 2 years ago

@typhoe are you able to find trakt.tv official docs or description how they slugify? perhaps ask their support?

typhoe commented 2 years ago

No sorry.

I only posted my issue here because one of the dev from PlexTraktSync told me the issue seemed to be from the slugify() function : https://github.com/Taxel/PlexTraktSync/issues/615#issuecomment-972825342 and asked me to post here : https://github.com/Taxel/PlexTraktSync/issues/615#issuecomment-972928210

I asked on the Trakt ticket support but that could take a while ;-) https://support.trakt.tv/support/tickets/10789

typhoe commented 2 years ago

Hi,

Justin of Trakt support answered me, I'll copy/paste their answer below:

The rules would be defined in https://github.com/norman/friendly_id/ but in general I'd recommend using IDs to match and not relying on a slug. If you know the Trakt ID, ​that can be used in the URL or you use some of the lookup functionality we have like this:

https://trakt.docs.apiary.io/#reference/search/id-lookup/get-id-lookup-results https://trakt.docs.apiary.io/#introduction/website-media-links

I'd highly recommend using IDs since Trakt could have different titles (and thus different slugs) compared to TMDB or TVDB.