xbmc / xbmc/metadata.themoviedb.org.python

find_uniqueids_in_text fails to extract IMDb ID from URLs with language prefix (e.g. /de/)

Open Beginner friendly
#257 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
60
Forks
50
Avg merge
11h 38m
Merged PRs (30d)
1

Description

The regex in scraper_datahelper.py used to extract IMDb IDs from NFO files fails when the URL contains a language prefix like /de/.

Affected regex:

res = re.search(r'imdb....?/title/tt([0-9]+)', input_text)

Example URL that fails:

https://www.imdb.com/de/title/tt14280366/

The regex expects imdb.com/title/... but the URL has imdb.com/de/title/..., so no ID is extracted. Kodi then falls back to a title search, which fails for movies whose filename contains transliterated umlauts (e.g. Kuechenbrigade instead of Küchenbrigade).

Proposed fix:

res = re.search(r'imdb....?/(?:[a-z]+/)?title/tt([0-9]+)', input_text)

The (?:[a-z]+/)? makes the optional language prefix match correctly.

Steps to reproduce:

  1. Have an NFO file containing an IMDb URL with a language prefix, e.g. https://www.imdb.com/de/title/tt14280366/
  2. Scan the file into Kodi library using the TMDB Python scraper
  3. Kodi logs: Find movie with title '...' from year '...' — meaning the ID was not found and it fell back to title search

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in scraper_datahelper.py at the regex used by find_uniqueids_in_text, and verify its behavior with the example IMDb URL containing /de/. Done means the IMDb ID is extracted from language-prefixed URLs so Kodi does not fall back to title search; reproduce by scanning an NFO file into the Kodi library.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.