-
Notifications
You must be signed in to change notification settings - Fork 850
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
2,228 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "Anthelion", | ||
"timezoneOffset": "+0000", | ||
"description": "Movies", | ||
"url": "https://anthelion.me//", | ||
"icon": "https://anthelion.me/favicon.ico", | ||
"tags": ["电影"], | ||
"schema": "GazelleJSONAPI", | ||
"host": "anthelion.me", | ||
"collaborator": "enigamz", | ||
"searchEntryConfig": { | ||
"skipIMDbId": true, | ||
"parseScriptFile": "getSearchResult.js" | ||
}, | ||
"searchEntry": [{ | ||
"name": "all", | ||
"enabled": true | ||
}], | ||
"selectors": { | ||
"userSeedingTorrents": { | ||
"page": "/torrents.php?type=seeding&userid=$user.id$", | ||
"fields": { | ||
"seedingSize": { | ||
"selector": ["tr.torrent_row > td.nobr"], | ||
"filters": ["jQuery.map(query, (item)=>{return $(item).text();})", "_self.getTotalSize(query)"] | ||
}, | ||
"bonus": { | ||
"selector": ["a[href*='store.php']"], | ||
"filters": ["query.text().replace(/,/g,'').match(/.+?([\\d.]+)/)", "(query && query.length>=2)?query[1]:0"] | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
(function(options) { | ||
class Parser { | ||
constructor() { | ||
this.haveData = false; | ||
this.categories = {}; | ||
if (/auth_form/.test(options.responseText)) { | ||
options.status = ESearchResultParseStatus.needLogin; | ||
return; | ||
} | ||
options.isLogged = true; | ||
this.haveData = true; | ||
this.authkey = ""; | ||
this.passkey = ""; | ||
} | ||
|
||
start() { | ||
this.getAuthKey() | ||
.then(() => { | ||
options.resolve(this.getResult()); | ||
}) | ||
.catch(() => { | ||
options.reject({ | ||
success: false, | ||
msg: options.searcher.getErrorMessage( | ||
options.site, | ||
ESearchResultParseStatus.parseError, | ||
options.errorMsg | ||
), | ||
data: { | ||
site: options.site, | ||
isLogged: options.isLogged | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
/** | ||
* 获取搜索结果 | ||
*/ | ||
|
||
getResult() { | ||
if (!this.haveData) { | ||
return []; | ||
} | ||
let site = options.site; | ||
let groups = options.page.response.results; | ||
if (groups.length == 0) { | ||
options.status = ESearchResultParseStatus.noTorrents; | ||
return []; | ||
} | ||
let results = []; | ||
let authkey = this.authkey; | ||
let passkey = this.passkey; | ||
console.log("groups.length", groups.length); | ||
try { | ||
groups.forEach(group => { | ||
if (group.hasOwnProperty("torrents")) { | ||
let torrents = group.torrents; | ||
torrents.forEach(torrent => { | ||
let data = { | ||
title: | ||
group.groupName + | ||
" [" + | ||
group.groupYear + | ||
"]", | ||
subTitle: | ||
torrent.codec + | ||
" / " + | ||
torrent.container + | ||
" / " + | ||
torrent.media + | ||
" / " + | ||
torrent.resolution + | ||
" / " + | ||
torrent.audio + | ||
(torrent.hasLog ? ` / Log(${torrent.logScore})` : "") + | ||
(torrent.hasCue ? " / Cue" : "") + | ||
(torrent.remastered ? ` / ${torrent.remasterYear}` : "") + | ||
(torrent.scene ? " / Scene" : "") + | ||
(torrent.isFreeleech || | ||
torrent.isNeutralLeech || | ||
torrent.isPersonalFreeleech | ||
? " / Freeleech" | ||
: ""), | ||
link: `${site.url}torrents.php?id=${group.groupId}&torrentid=${torrent.torrentId}`, | ||
url: `${site.url}torrents.php?action=download&id=${torrent.torrentId}&authkey=${authkey}&torrent_pass=${passkey}`, | ||
size: parseFloat(torrent.size), | ||
time: torrent.time, | ||
seeders: torrent.seeders, | ||
leechers: torrent.leechers, | ||
completed: torrent.snatches, | ||
site: site, | ||
entryName: options.entry.name, | ||
category: group.releaseType | ||
}; | ||
results.push(data); | ||
}); | ||
} else { | ||
let data = { | ||
title: group.groupName, | ||
link: `${site.url}torrents.php?id=${group.groupId}&torrentid=${group.torrentId}`, | ||
url: `${site.url}torrents.php?action=download&id=${group.torrentId}&authkey=${authkey}&torrent_pass=${passkey}`, | ||
size: parseFloat(group.size), | ||
time: group.groupTime, | ||
author: "", | ||
seeders: group.seeders, | ||
leechers: group.leechers, | ||
completed: group.snatches, | ||
comments: 0, | ||
site: site, | ||
tags: group.tags, | ||
entryName: options.entry.name, | ||
category: group.category | ||
}; | ||
results.push(data); | ||
} | ||
}); | ||
console.log("results.length", results.length); | ||
if (results.length == 0) { | ||
options.status = ESearchResultParseStatus.noTorrents; | ||
} | ||
} catch (error) { | ||
console.log(error); | ||
options.status = ESearchResultParseStatus.parseError; | ||
options.errorMsg = error.stack; | ||
} | ||
return results; | ||
} | ||
|
||
/** | ||
* 获取 AuthKey ,用于组合完整的下载链接 | ||
*/ | ||
getAuthKey() { | ||
const url = (options.site.activeURL + "/ajax.php?action=index") | ||
.replace("://", "****") | ||
.replace(/\/\//g, "/") | ||
.replace("****", "://"); | ||
|
||
return new Promise((resolve, reject) => { | ||
$.get(url) | ||
.done(result => { | ||
if (result && result.status === "success" && result.response) { | ||
this.authkey = result.response.authkey; | ||
this.passkey = result.response.passkey; | ||
resolve(); | ||
} else { | ||
reject(); | ||
} | ||
}) | ||
.fail(() => { | ||
reject(); | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
let parser = new Parser(options); | ||
parser.start(); | ||
})(options); |
Oops, something went wrong.