Skip to content

Commit

Permalink
add support for current hhanclub UI
Browse files Browse the repository at this point in the history
  • Loading branch information
sagan committed Dec 13, 2023
1 parent ecb415f commit a2c05e6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/cookiecloud/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ func sync(cmd *cobra.Command, args []string) error {
fmt.Printf("✕Sites invalid-cookie (no new valid cookie found) (%d): %s\n", len(sitesInvalid), strings.Join(sitesInvalid, ", "))
fmt.Printf("✓✓Sites success-with-new-cookie (%d): %s\n", len(sitesUpdated), strings.Join(sitesUpdated, ", "))

fmt.Printf("\n")
if len(updatesites) > 0 {
configFile := fmt.Sprintf("%s/%s", config.ConfigDir, config.ConfigFile)
fmt.Printf("\n")
if !doAction && !util.AskYesNoConfirm(fmt.Sprintf(
"Will update the config file (%s). Be aware that all existing comments will be LOST", configFile)) {
return fmt.Errorf("abort")
Expand Down
9 changes: 4 additions & 5 deletions site/nexusphp/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ func parseTorrents(doc *goquery.Document, option *TorrentsParserOption,
}
})
}
log.Tracef("np parse fieldColumIndex: %v", fieldColumIndex)
var torrentBlocks *goquery.Selection
if option.selectorTorrentBlock != "" {
torrentBlocks = containerEl.Find(option.selectorTorrentBlock)
Expand Down Expand Up @@ -368,7 +369,7 @@ func parseTorrents(doc *goquery.Document, option *TorrentsParserOption,
} else if id != "" {
downloadUrl = option.siteurl + generateTorrentDownloadUrl(id, option.torrentDownloadUrl, option.npletdown)
}
if fieldColumIndex["time"] == -1 {
if fieldColumIndex["time"] == -1 || time == 0 {
if option.selectorTorrentTime != "" {
time, _ = util.ExtractTime(util.DomSelectorText(s, option.selectorTorrentTime), option.location)
} else {
Expand All @@ -385,10 +386,8 @@ func parseTorrents(doc *goquery.Document, option *TorrentsParserOption,
if fieldColumIndex["snatched"] == -1 && option.selectorTorrentSnatched != "" {
snatched = util.ParseInt(util.DomSelectorText(s, option.selectorTorrentSnatched))
}
if fieldColumIndex["size"] == -1 {
if option.selectorTorrentSize != "" {
size, _ = util.RAMInBytes(util.DomSelectorText(s, option.selectorTorrentSize))
}
if (fieldColumIndex["size"] == -1 || size <= 0) && option.selectorTorrentSize != "" {
size, _ = util.RAMInBytes(util.DomSelectorText(s, option.selectorTorrentSize))
}
if s.Find(`*[title="H&R"],*[alt="H&R"],*[title="Hit and Run"]`).Length() > 0 {
hnr = true
Expand Down
18 changes: 13 additions & 5 deletions site/tpl/tpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,19 @@ var (
Comment: "高清地带",
},
"hhanclub": {
Type: "nexusphp",
Aliases: []string{"hh", "hhan"},
Url: "https://hhanclub.top/",
Domains: []string{"hhan.club"},
Comment: "憨憨",
Type: "nexusphp",
Aliases: []string{"hh", "hhan"},
Url: "https://hhanclub.top/",
Domains: []string{"hhan.club"},
SelectorUserInfoUploaded: `img[alt="上传"],img[alt="上傳"]@after`,
SelectorUserInfoDownloaded: `img[alt="下载"],img[alt="下載"]@after`,
SelectorTorrentSize: `.torrent-info-text-size`,
SelectorTorrentTime: `.torrent-info-text-added`,
SelectorTorrentSeeders: `.torrent-info-text-seeders`,
SelectorTorrentLeechers: `.torrent-info-text-leechers`,
SelectorTorrentSnatched: `.torrent-info-text-finished`,
SelectorTorrentProcessBar: `.w-full[title$="%"] .h-full`,
Comment: "憨憨",
},
"htpt": {
Type: "nexusphp",
Expand Down

0 comments on commit a2c05e6

Please sign in to comment.