parsers/parsers.go

82 lines
1.8 KiB
Go
Raw Normal View History

2022-08-04 00:05:19 +02:00
package parsers
2022-08-15 16:43:27 +02:00
import "git.milar.in/nyaanime/model"
2022-08-04 00:05:19 +02:00
/*
how to get all torrent names on a nyaa page:
let s = "";
2022-08-15 16:43:27 +02:00
document.querySelectorAll("tr > td:nth-child(2) > a:not(.comments)").forEach(element => {
2022-08-04 00:05:19 +02:00
s += element.textContent + "\n";
})
console.log(s);
*/
var Parsers = []model.Parser{
{
Identity: "Erai-Raws",
2022-12-07 19:57:40 +01:00
TorrentParser: RegexTorrentParser(
2022-08-04 18:13:41 +02:00
`^\[Erai-raws\] (.*) - (.*?) \[(.*?)p\](?:\[HEVC\])?(?:\[Multiple Subtitle\])? (\[.*?\]+)?$`,
TorrentParseOptions{
2022-08-15 13:06:19 +02:00
Name: 1,
Episode: 2,
Resolution: 3,
Subtitles: 4,
SubtitleParser: SquareBracketsLanguageParser,
DefaultLanguages: []string{"ja"},
2022-08-04 18:13:41 +02:00
},
2022-08-04 00:05:19 +02:00
),
2022-12-07 20:25:13 +01:00
FileParser: RegexFileParser(
`^\[Erai-raws\] (.*?) - (\d+?) .*?\.mkv$`,
FileParseOptions{
Name: 1,
Episode: 2,
},
),
2022-08-04 00:05:19 +02:00
},
2022-08-25 18:21:45 +02:00
{
Identity: "SubsPlease",
2022-12-07 19:57:40 +01:00
TorrentParser: RegexTorrentParser(
2022-08-25 18:21:45 +02:00
`^\[SubsPlease\] (.*) - (\d+?) \((.*?)\) \[.*?\].mkv$`,
TorrentParseOptions{
Name: 1,
Episode: 2,
Resolution: 3,
DefaultLanguages: []string{"ja"},
DefaultSubtitles: []string{"en"},
},
),
2022-12-07 20:25:13 +01:00
FileParser: RegexFileParser(
`^\[SubsPlease\] (.*?) - (\d+?) .*?\.mkv$`,
FileParseOptions{
Name: 1,
Episode: 2,
},
),
2022-08-25 18:21:45 +02:00
},
2022-08-25 18:35:41 +02:00
{
Identity: "PuyaSubs!",
2022-12-07 19:57:40 +01:00
TorrentParser: RegexTorrentParser(
2022-08-25 18:35:41 +02:00
`^\[PuyaSubs!\] (.*) - (\d+?) \[ESP-ENG\]\[(.*?)\]\[.*?\]\.mkv$`,
TorrentParseOptions{
Name: 1,
Episode: 2,
Resolution: 3,
DefaultLanguages: []string{"ja"},
DefaultSubtitles: []string{"en"},
},
),
2022-12-07 20:25:13 +01:00
FileParser: RegexFileParser(
`^\[PuyaSubs!\] (.*?) - (\d+?) .*?\.mkv$`,
FileParseOptions{
Name: 1,
Episode: 2,
},
),
FileEncoding: "-map 0 -c:v copy -c:a copy -c:s copy -metadata:s:a:0 language=jap",
2022-08-25 18:35:41 +02:00
},
2022-08-04 00:05:19 +02:00
}