Feat/Rede torrents (#34)
* new: feat: add brand new redetorrent.com indexer * chg: refactor: create common package * chg: fix: comandohds formatting * chg: fix: dual audio detection * chg: fix: parsing issues * chg: refactor: remove duplicated code * chg: refactor: move test funcs to common file
This commit is contained in:
@@ -143,7 +143,7 @@ func getTorrentsTorrentDosFilmes(ctx context.Context, i *Indexer, link string) (
|
||||
article := doc.Find("article")
|
||||
title := strings.Replace(article.Find(".title > h1").Text(), " - Download", "", -1)
|
||||
textContent := article.Find("div.content")
|
||||
date := getPublishedDateTDF(doc)
|
||||
date := getPublishedDateFromMeta(doc)
|
||||
magnets := textContent.Find("a[href^=\"magnet\"]")
|
||||
var magnetLinks []string
|
||||
magnets.Each(func(i int, s *goquery.Selection) {
|
||||
@@ -206,19 +206,7 @@ func getTorrentsTorrentDosFilmes(ctx context.Context, i *Indexer, link string) (
|
||||
releaseTitle := magnet.DisplayName
|
||||
infoHash := magnet.InfoHash.String()
|
||||
trackers := magnet.Trackers
|
||||
magnetAudio := []schema.Audio{}
|
||||
if strings.Contains(strings.ToLower(releaseTitle), "dual") || strings.Contains(strings.ToLower(releaseTitle), "dublado") {
|
||||
magnetAudio = append(magnetAudio, audio...)
|
||||
} else if len(audio) > 1 {
|
||||
// remove portuguese audio, and append to magnetAudio
|
||||
for _, a := range audio {
|
||||
if a != schema.AudioPortuguese {
|
||||
magnetAudio = append(magnetAudio, a)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
magnetAudio = append(magnetAudio, audio...)
|
||||
}
|
||||
magnetAudio := getAudioFromTitle(releaseTitle, audio)
|
||||
|
||||
peer, seed, err := goscrape.GetLeechsAndSeeds(ctx, i.redis, i.metrics, infoHash, trackers)
|
||||
if err != nil {
|
||||
@@ -259,15 +247,3 @@ func getTorrentsTorrentDosFilmes(ctx context.Context, i *Indexer, link string) (
|
||||
|
||||
return indexedTorrents, nil
|
||||
}
|
||||
|
||||
func getPublishedDateTDF(document *goquery.Document) time.Time {
|
||||
var date time.Time
|
||||
//<meta property="article:published_time" content="2019-08-23T13:20:57+00:00">
|
||||
datePublished := strings.TrimSpace(document.Find("meta[property=\"article:published_time\"]").AttrOr("content", ""))
|
||||
|
||||
if datePublished != "" {
|
||||
date, _ = time.Parse(time.RFC3339, datePublished)
|
||||
}
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user