mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-05 08:59:46 +00:00
proper feed parsing
This commit is contained in:
parent
396f5e8ed7
commit
38ab15e5d5
2 changed files with 10 additions and 8 deletions
|
|
@ -339,9 +339,11 @@ async function nyaaRss(url) {
|
|||
}
|
||||
|
||||
|
||||
const regex = /((?:\[[^\]]*\])*)?\s*((?:[^\d\[\.](?!S\d))*)?\s*((?:S\d+[^\w\[]*E?)?[\d\-]*)\s*(.*)?/i,
|
||||
eregex = /(\[.*\]\ ?)?(.+?(?=\ \–\ \d))?(\ \–\ )?(\d+)?/i,
|
||||
plsregex = /(\[.[^\]]*\]\ ?)?(.+?(?=\ \-\ \d))?(\ \-\ )?(\d+)?(.*)?/i
|
||||
const nameParseRegex = {
|
||||
"https://subsplease.org/rss/?r=": /(\[.[^\]]*\]\ ?)?(.+?(?=\ \-\ \d))?(\ \-\ )?(\d+)?(.*)?/i,
|
||||
"https://miru.kirdow.com/request/?url=https://www.erai-raws.info/rss-": /(\[.*\]\ ?)?(.+?(?=\ \–\ \d))?(\ \–\ )?(\d+)?/i,
|
||||
fallback: /((?:\[[^\]]*\])*)?\s*((?:[^\d\[\.](?!S\d))*)?\s*((?:S\d+[^\w\[]*E?)?[\d\-]*)\s*(.*)?/i
|
||||
}
|
||||
let store = {},
|
||||
lastResult
|
||||
|
||||
|
|
@ -361,7 +363,7 @@ async function hsRss() {
|
|||
let items = doc.querySelectorAll("item")
|
||||
for (let item of items) {
|
||||
let i = item.querySelector.bind(item),
|
||||
regexParse = plsregex.exec(i("title").textContent)
|
||||
regexParse = (nameParseRegex[settings.torrent4]||nameParseRegex.parse).exec(i("title").textContent)
|
||||
if (!store.hasOwnProperty(regexParse[2]) && !alResponse.data.Page.media.some(media => (Object.values(media.title).concat(media.synonyms).filter(name => name != null).includes(regexParse[2]) && ((store[regexParse[2]] = media) && true)))) {
|
||||
//shit not found, lookup
|
||||
let res = await alRequest(regexParse[2], 1)
|
||||
|
|
|
|||
|
|
@ -32,14 +32,14 @@ $url = str_replace("$", "&", $_GET['url']);
|
|||
}
|
||||
}
|
||||
}
|
||||
elseif (substr($url, 0, 30) === "https://www.erai-rss.info/rss-") {
|
||||
$query = explode("https://www.erai-rss.info/", $url) [1];
|
||||
elseif (substr($url, 0, 31) === "https://www.erai-raws.info/rss-") {
|
||||
$query = explode("https://www.erai-raws.info/rss-", $url) [1];
|
||||
$query_check = basename(realpath($query));
|
||||
if ($query_check === "") {
|
||||
if (strpos($query, '/') === false) {
|
||||
$cache_file = './cache_erai/' . $query;
|
||||
//echo $url.'\n';
|
||||
//echo $cache_file.'\n';
|
||||
// echo $url.'\n';
|
||||
// echo $cache_file.'\n';
|
||||
if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 60 * 1))) {
|
||||
// Cache file is less than five minutes old.
|
||||
// Don't bother refreshing, just use the file as-is.
|
||||
|
|
|
|||
Loading…
Reference in a new issue