diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index 0b0af836..2bf7b73c 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -1276,7 +1276,7 @@ public class MediaDetection { public static List grepTheTvdbId(CharSequence text) { // scan for thetvdb id patterns like http://www.thetvdb.com/?tab=series&id=78874&lid=14 - Pattern tvdbUrl = Pattern.compile("http[s]?://www.thetvdb.com/[?]tab=series&id=(\\d+)", Pattern.CASE_INSENSITIVE); + Pattern tvdbUrl = Pattern.compile("\\w+://(?:\\w+[.])?thetvdb.com/[?]tab=\\w+&id=(\\d+)", Pattern.CASE_INSENSITIVE); return streamMatches(text, tvdbUrl, m -> m.group(1)).map(Integer::new).collect(toList()); } diff --git a/test/net/filebot/media/MediaDetectionTest.java b/test/net/filebot/media/MediaDetectionTest.java index a97a4edb..55404163 100644 --- a/test/net/filebot/media/MediaDetectionTest.java +++ b/test/net/filebot/media/MediaDetectionTest.java @@ -34,6 +34,8 @@ public class MediaDetectionTest { @Test public void grepTheTvdbId() throws Exception { assertEquals("[78874]", MediaDetection.grepTheTvdbId("@see http://www.thetvdb.com/?tab=series&id=78874&lid=14").toString()); + assertEquals("[78874]", MediaDetection.grepTheTvdbId("@see http://thetvdb.com/?tab=series&id=78874&lid=14").toString()); + assertEquals("[78874]", MediaDetection.grepTheTvdbId("@see https://www.thetvdb.com/?tab=seasonall&id=78874&lid=14").toString()); } }