1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2025-01-03 05:44:50 +00:00

Simplify parsing IMDb and TMDb urls as search terms

This commit is contained in:
Bogdan 2024-10-10 03:23:00 +03:00
parent 64122b4cfb
commit f90b43b3e1

View file

@ -406,14 +406,16 @@ public List<Movie> SearchForNewMovie(string title)
{ {
try try
{ {
var match = new Regex("^https://www.imdb.com/title/(tt[0-9]+).*?$").Match(title); var match = new Regex(@"\bimdb\.com/title/(tt\d{7,})\b", RegexOptions.IgnoreCase).Match(title);
if (match.Success) if (match.Success)
{ {
title = "imdb:" + match.Groups[1].Value; title = "imdb:" + match.Groups[1].Value;
} }
else else
{ {
match = new Regex("^https://www.themoviedb.org/movie/([0-9]+).*$").Match(title); match = new Regex(@"\bthemoviedb\.org/movie/(\d+)\b", RegexOptions.IgnoreCase).Match(title);
if (match.Success) if (match.Success)
{ {
title = "tmdb:" + match.Groups[1].Value; title = "tmdb:" + match.Groups[1].Value;