Skip to content

Commit

Permalink
update ua to chrome v118; tweak free torrent recognization codes for …
Browse files Browse the repository at this point in the history
…np sites
  • Loading branch information
sagan committed Oct 19, 2023
1 parent cf7bd67 commit 90eb799
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 35 deletions.
4 changes: 2 additions & 2 deletions cmd/shell/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ var exitfCmd = &cobra.Command{
Short: `(shell only) Alias of "exit -f". Exit shell immediately & forcely`,
Args: cobra.MatchAll(cobra.ExactArgs(0), cobra.OnlyValidArgs),
RunE: func(cmd *cobra.Command, args []string) error {
force = true
return exitCmd.RunE(cmd, args)
os.Exit(0)
return nil
},
}

Expand Down
7 changes: 2 additions & 5 deletions site/nexusphp/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,8 @@ func parseTorrents(doc *goquery.Document, option *TorrentsParserOption,
} else if s.Find(`*[title="免费"],*[title="免費"],*[alt="Free"],*[alt="FREE"]`).Length() > 0 ||
domCheckTextTagExisting(s, "free") {
downloadMultiplier = 0
} else if option.selectorTorrentFree != "" {
text := strings.ToLower(util.DomSelectorText(s, option.selectorTorrentFree))
if strings.Contains(text, "免费") || strings.Contains(text, "免費") || strings.Contains(text, "free") {
downloadMultiplier = 0
}
} else if option.selectorTorrentFree != "" && s.Find(option.selectorTorrentFree).Length() > 0 {
downloadMultiplier = 0
}
if option.selectorTorrentPaid != "" && s.Find(option.selectorTorrentPaid).Length() > 0 {
paid = true
Expand Down
25 changes: 16 additions & 9 deletions site/tpl/tpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ var (
GlobalHnR: true,
Comment: "学校",
},
"byr": {
Type: "nexusphp",
Url: "https://byr.pt/",
SelectorTorrentFree: `.pro_free, .pro_free2up`,
Comment: "北邮人",
},
"carpt": {
Type: "nexusphp",
Url: "https://carpt.net/",
Expand Down Expand Up @@ -312,13 +318,13 @@ var (
Comment: "红叶",
},
"lemonhd": {
Type: "nexusphp",
Aliases: []string{"leaguehd", "lemon"},
Url: "https://lemonhd.org/",
Domains: []string{"leaguehd.com"},
TorrentsUrl: "https://lemonhd.org/torrents_new.php",
SelectorTorrentFree: "div",
Comment: "柠檬",
Type: "nexusphp",
Aliases: []string{"leaguehd", "lemon"},
Url: "https://lemonhd.org/",
Domains: []string{"leaguehd.com"},
TorrentsUrl: "https://lemonhd.org/torrents_new.php",
// SelectorTorrentFree: "div",
Comment: "柠檬",
},
"m-team": {
Type: "nexusphp",
Expand Down Expand Up @@ -412,8 +418,8 @@ var (
SelectorTorrent: ".torrent-action-bookmark",
SelectorTorrentProcessBar: ".torrent-progress",
SelectorUserInfo: ".m_nav",
SelectorTorrentFree: ".s-tag",
Comment: "鲨鱼",
// SelectorTorrentFree: ".s-tag",
Comment: "鲨鱼",
},
"skyeysnow": {
Type: "discuz",
Expand All @@ -440,6 +446,7 @@ var (
Domains: []string{"dmhy.best"},
// 下载中,下载完成过,做种中,当前未做种
SelectorTorrentProcessBar: `.leechhlc_current,.snatchhlc_finish,.seedhlc_current,.seedhlc_ever_inenough`,
SelectorTorrentFree: `*[alt="下載比率"] + b:contains("0.00X")`,
Comment: "U2 (动漫花园)",
},
"ubits": {
Expand Down
32 changes: 13 additions & 19 deletions util/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,19 @@ var (
CHROME_HTTP_REQUEST_HEADERS = map[string]string{
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
// "Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9",
"Cache-Control": "max-age=0",
"Connection": "keep-alive",
"Sec-Ch-Ua": `"Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"`,
"Sec-Ch-Ua-Arch": `"x86"`,
"Sec-Ch-Ua-Bitness": `"64"`,
"Sec-Ch-Ua-Full-Version": `"117.0.5938.92"`,
"Sec-Ch-Ua-Full-Version-List": `"Google Chrome";v="117.0.5938.92", "Not;A=Brand";v="8.0.0.0", "Chromium";v="117.0.5938.92"`,
"Sec-Ch-Ua-Mobile": `?0`,
"Sec-Ch-Ua-Model": `""`,
"Sec-Ch-Ua-Platform": `"Windows"`,
"Sec-Ch-Ua-Platform-Version": `"15.0.0"`,
"Sec-Ch-Ua-Wow64": `?0`,
"Sec-Fetch-Dest": `document`,
"Sec-Fetch-Mode": `navigate`,
"Sec-Fetch-Site": `same-origin`,
"Sec-Fetch-User": `?1`,
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
"Accept-Language": "en-US,en;q=0.9",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Pragma": "no-cache",
"Sec-Ch-Ua": `"Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"`,
"Sec-Ch-Ua-Mobile": `?0`,
"Sec-Ch-Ua-Platform": `"Windows"`,
"Sec-Fetch-Dest": `document`,
"Sec-Fetch-Mode": `navigate`,
"Sec-Fetch-Site": `same-origin`,
"Sec-Fetch-User": `?1`,
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
}
)

Expand Down

0 comments on commit 90eb799

Please sign in to comment.