@xriss/weerss 0.0.27 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/torrents.js +21 -4
- package/weerss.js +1 -1
package/package.json
CHANGED
package/torrents.js
CHANGED
|
@@ -11,9 +11,6 @@ import WebTorrent from 'webtorrent'
|
|
|
11
11
|
import { remote } from 'parse-torrent'
|
|
12
12
|
import memchunks from 'memory-chunk-store'
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
14
|
torrents.get=async function(url) // always slow
|
|
18
15
|
{
|
|
19
16
|
return await db.get("torrents",url)
|
|
@@ -30,6 +27,23 @@ torrents.fetch=async function(url)
|
|
|
30
27
|
let ret = await torrents.get(url)
|
|
31
28
|
if( ret && ret.data) { return ret.data }
|
|
32
29
|
|
|
30
|
+
|
|
31
|
+
// resolve url ( which may redirect to a magnet, damn you jacket )
|
|
32
|
+
while(url.toLowerCase().startsWith("http"))
|
|
33
|
+
{
|
|
34
|
+
let r=await fetch(url, { redirect: 'manual' })
|
|
35
|
+
if( r && r.status>=300 && r.status<=399 )
|
|
36
|
+
{
|
|
37
|
+
let location=r.headers.get("location")
|
|
38
|
+
if(url==location) { break }
|
|
39
|
+
url=location
|
|
40
|
+
}
|
|
41
|
+
else // finished
|
|
42
|
+
{
|
|
43
|
+
break
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
33
47
|
let urlplus=url
|
|
34
48
|
if(urlplus.toLowerCase().startsWith("magnet:")) // auto add trackers
|
|
35
49
|
{
|
|
@@ -46,11 +60,14 @@ torrents.fetch=async function(url)
|
|
|
46
60
|
}
|
|
47
61
|
}
|
|
48
62
|
}
|
|
63
|
+
else // follow redirects
|
|
64
|
+
{
|
|
65
|
+
}
|
|
49
66
|
// console.log(urlplus)
|
|
50
67
|
|
|
51
68
|
let torrent_parse=function(url) {
|
|
52
69
|
return new Promise(function(resolve, reject) {
|
|
53
|
-
remote(url, { timeout: 60 * 1000 }, function(err, parsedTorrent){
|
|
70
|
+
remote(url, { timeout: 60 * 1000 , followRedirects: true }, function(err, parsedTorrent){
|
|
54
71
|
if (err) { reject(err) }
|
|
55
72
|
resolve(parsedTorrent)
|
|
56
73
|
})
|
package/weerss.js
CHANGED
|
@@ -272,7 +272,7 @@ weerss.getlist=async function(filters)
|
|
|
272
272
|
{
|
|
273
273
|
if(!item.show.date) { return false }
|
|
274
274
|
let now=(new Date()).getTime()
|
|
275
|
-
let test=Date.parse(
|
|
275
|
+
let test=Date.parse(item.show.date)
|
|
276
276
|
let days=Math.floor((now-test)/(1000*60*60*24))
|
|
277
277
|
if( days > weerss.config.episode.maxage ) { return false } // this episode is too old
|
|
278
278
|
}
|