Fix: Add adware url decoding support (#33)
* chg: fix: add bludv url decoding support * chg: feat: add safeguards against future algorithim changes
This commit is contained in:
24
api/bludv.go
24
api/bludv.go
@@ -152,6 +152,30 @@ func getTorrentsBluDV(ctx context.Context, i *Indexer, link string) ([]schema.In
|
||||
magnetLinks = append(magnetLinks, magnetLink)
|
||||
})
|
||||
|
||||
adwareLinks := textContent.Find("a[href^=\"https://www.seuvideo.xyz\"]")
|
||||
adwareLinks.Each(func(_ int, s *goquery.Selection) {
|
||||
href, _ := s.Attr("href")
|
||||
// extract querysting "id" from url
|
||||
parsedUrl, err := url.Parse(href)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
magnetLink := parsedUrl.Query().Get("id")
|
||||
magnetLinkDecoded, err := utils.DecodeAdLink(magnetLink)
|
||||
if err != nil {
|
||||
fmt.Printf("failed to decode ad link \"%s\": %v\n", href, err)
|
||||
return
|
||||
}
|
||||
|
||||
// if decoded magnet link is indeed a magnet link, append it
|
||||
if strings.HasPrefix(magnetLinkDecoded, "magnet:") {
|
||||
magnetLinks = append(magnetLinks, magnetLinkDecoded)
|
||||
} else {
|
||||
fmt.Printf("WARN: link \"%s\" decoding resulted in non-magnet link: %s\n", href, magnetLinkDecoded)
|
||||
}
|
||||
})
|
||||
|
||||
var audio []schema.Audio
|
||||
var year string
|
||||
var size []string
|
||||
|
||||
Reference in New Issue
Block a user