This repository was archived by the owner on Jun 15, 2023. It is now read-only.
File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ require (
11
11
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 // indirect
12
12
github.com/boypt/scraper v1.0.3
13
13
github.com/c2h5oh/datasize v0.0.0-20200825124411-48ed595a09d2
14
+ github.com/dustin/go-humanize v1.0.0 // indirect
14
15
github.com/elithrar/simple-scrypt v1.3.0 // indirect
15
16
github.com/fatih/structs v1.1.0 // indirect
16
17
github.com/fsnotify/fsnotify v1.4.9
Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ import (
5
5
"net/http"
6
6
"regexp"
7
7
"sort"
8
+ "strconv"
8
9
"strings"
9
10
"time"
10
11
12
+ "github.com/dustin/go-humanize"
11
13
"github.com/mmcdole/gofeed"
12
14
)
13
15
@@ -40,7 +42,7 @@ func (ritem *rssJSONItem) findFromFeedItem(i *gofeed.Item) (found bool) {
40
42
for _ , e := range i .Enclosures {
41
43
if strings .HasPrefix (e .URL , "magnet:" ) {
42
44
ritem .Magnet = e .URL
43
- } else if e . Type == "application/x-bittorrent" {
45
+ } else if torrentExp . Match ([] byte ( e . URL )) {
44
46
ritem .Torrent = e .URL
45
47
}
46
48
}
@@ -79,6 +81,12 @@ func (r *rssJSONItem) readExtention(i *gofeed.Item, ext string) (found bool) {
79
81
r .Size = e [0 ].Value
80
82
}
81
83
84
+ if e , ok := etor ["contentLength" ]; ok && len (e ) > 0 {
85
+ if size , err := strconv .ParseUint (e [0 ].Value , 10 , 64 ); err == nil {
86
+ r .Size = humanize .Bytes (size )
87
+ }
88
+ }
89
+
82
90
if e , ok := etor ["magnetURI" ]; ok && len (e ) > 0 {
83
91
r .Magnet = e [0 ].Value
84
92
found = true
You can’t perform that action at this time.
0 commit comments