PyTrakt icon indicating copy to clipboard operation
PyTrakt copied to clipboard

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

Open typhoe opened this issue 3 years ago • 6 comments

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

typhoe avatar Nov 18 '21 15:11 typhoe

Are you willing to provide a fix?

The current slugify is defined here:

  • https://github.com/moogar0880/PyTrakt/blob/8a6d4f168a858447014fb4c2c0efceb47b30ebb7/trakt/utils.py#L10-L20

glensc avatar Jan 15 '22 11:01 glensc

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

`some text inside backticks`

glensc avatar Jan 15 '22 11:01 glensc

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.

typhoe avatar Jan 17 '22 08:01 typhoe

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

glensc avatar Jan 17 '22 09:01 glensc

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 avatar Jan 17 '22 09:01 typhoe

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.

typhoe avatar Jan 24 '22 18:01 typhoe