parsers/parsers.go
2022-12-07 19:57:40 +01:00

63 lines
1.4 KiB
Go

package parsers
import "git.milar.in/nyaanime/model"
/*
how to get all torrent names on a nyaa page:
let s = "";
document.querySelectorAll("tr > td:nth-child(2) > a:not(.comments)").forEach(element => {
s += element.textContent + "\n";
})
console.log(s);
*/
var Parsers = []model.Parser{
{
Identity: "Erai-Raws",
TorrentParser: RegexTorrentParser(
`^\[Erai-raws\] (.*) - (.*?) \[(.*?)p\](?:\[HEVC\])?(?:\[Multiple Subtitle\])? (\[.*?\]+)?$`,
TorrentParseOptions{
Name: 1,
Episode: 2,
Resolution: 3,
Subtitles: 4,
SubtitleParser: SquareBracketsLanguageParser,
DefaultLanguages: []string{"ja"},
},
),
FileParser: nil,
},
{
Identity: "SubsPlease",
TorrentParser: RegexTorrentParser(
`^\[SubsPlease\] (.*) - (\d+?) \((.*?)\) \[.*?\].mkv$`,
TorrentParseOptions{
Name: 1,
Episode: 2,
Resolution: 3,
DefaultLanguages: []string{"ja"},
DefaultSubtitles: []string{"en"},
},
),
FileParser: nil,
},
{
Identity: "PuyaSubs!",
TorrentParser: RegexTorrentParser(
`^\[PuyaSubs!\] (.*) - (\d+?) \[ESP-ENG\]\[(.*?)\]\[.*?\]\.mkv$`,
TorrentParseOptions{
Name: 1,
Episode: 2,
Resolution: 3,
DefaultLanguages: []string{"ja"},
DefaultSubtitles: []string{"en"},
},
),
FileParser: nil,
},
}