[scraper] improve episode detection when not parsed
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1870,8 +1870,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"parse-torrent-title": {
|
"parse-torrent-title": {
|
||||||
"version": "git://github.com/TheBeastLT/parse-torrent-title.git#07641d3631a2cf684f9a8cbbb4114e22c75915f8",
|
"version": "git://github.com/TheBeastLT/parse-torrent-title.git#e5bdf66ad570e4ece8863536ffaf0360efde9aaa",
|
||||||
"from": "git://github.com/TheBeastLT/parse-torrent-title.git#07641d3631a2cf684f9a8cbbb4114e22c75915f8",
|
"from": "git://github.com/TheBeastLT/parse-torrent-title.git#e5bdf66ad570e4ece8863536ffaf0360efde9aaa",
|
||||||
"requires": {
|
"requires": {
|
||||||
"moment": "^2.24.0"
|
"moment": "^2.24.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"nodejs-bing": "^0.1.0",
|
"nodejs-bing": "^0.1.0",
|
||||||
"nyaapi": "^2.3.3",
|
"nyaapi": "^2.3.3",
|
||||||
"parse-torrent": "^6.1.2",
|
"parse-torrent": "^6.1.2",
|
||||||
"parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#07641d3631a2cf684f9a8cbbb4114e22c75915f8",
|
"parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#e5bdf66ad570e4ece8863536ffaf0360efde9aaa",
|
||||||
"pg": "^7.8.2",
|
"pg": "^7.8.2",
|
||||||
"pg-hstore": "^2.3.2",
|
"pg-hstore": "^2.3.2",
|
||||||
"real-debrid-api": "git://github.com/TheBeastLT/node-real-debrid.git#935a5c23ae809edbcd2a111526a7f74d6767c50d",
|
"real-debrid-api": "git://github.com/TheBeastLT/node-real-debrid.git#935a5c23ae809edbcd2a111526a7f74d6767c50d",
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ function escapeTitle(title) {
|
|||||||
.replace(/&/g, 'and')
|
.replace(/&/g, 'and')
|
||||||
.replace(/[;, ~./]+/g, ' ') // replace dots, commas or underscores with spaces
|
.replace(/[;, ~./]+/g, ' ') // replace dots, commas or underscores with spaces
|
||||||
.replace(/[^\w \-()+#@!'\u0400-\u04ff]+/g, '') // remove all non-alphanumeric chars
|
.replace(/[^\w \-()+#@!'\u0400-\u04ff]+/g, '') // remove all non-alphanumeric chars
|
||||||
|
.replace(/^\d{1,2}[.#\s]+(?=(?:\d+[.\s]*)?[\u0400-\u04ff])/i, '') // remove russian movie numbering
|
||||||
.replace(/\s{2,}/, ' ') // replace multiple spaces
|
.replace(/\s{2,}/, ' ') // replace multiple spaces
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ function parseSeriesVideo(video, parsedTorrentName) {
|
|||||||
videoInfo.episodes = epMatcher && [parseInt(epMatcher[1], 10)];
|
videoInfo.episodes = epMatcher && [parseInt(epMatcher[1], 10)];
|
||||||
videoInfo.episode = videoInfo.episodes && videoInfo.episodes[0];
|
videoInfo.episode = videoInfo.episodes && videoInfo.episodes[0];
|
||||||
}
|
}
|
||||||
|
if (!videoInfo.episodes && !videoInfo.date) {
|
||||||
|
const epMatcher = video.name.match(new RegExp(`(?:\\(${videoInfo.year}\\)|part)[._ ]?(\\d{1,3})(?:\\b|_)`, "i"));
|
||||||
|
videoInfo.episodes = epMatcher && [parseInt(epMatcher[1], 10)];
|
||||||
|
videoInfo.episode = videoInfo.episodes && videoInfo.episodes[0];
|
||||||
|
}
|
||||||
|
|
||||||
return { ...video, ...videoInfo };
|
return { ...video, ...videoInfo };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user