accept headers for feeds
parent
18ec246ebc
commit
ae02290975
13
rss/feed.go
13
rss/feed.go
|
|
@ -1,6 +1,7 @@
|
||||||
package rss
|
package rss
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"local/rssmon3/config"
|
"local/rssmon3/config"
|
||||||
"log"
|
"log"
|
||||||
|
|
@ -23,6 +24,7 @@ type Feed struct {
|
||||||
ContentFilter string
|
ContentFilter string
|
||||||
Tags []string
|
Tags []string
|
||||||
Copyright string
|
Copyright string
|
||||||
|
Headers []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func SubmitFeed(f *Feed) error {
|
func SubmitFeed(f *Feed) error {
|
||||||
|
|
@ -61,7 +63,16 @@ func (f *Feed) Pull() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resp, err := http.Get(f.URL)
|
req, err := http.NewRequest(http.MethodGet, f.URL, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var headers map[string]string
|
||||||
|
json.Unmarshal(f.Headers, &headers)
|
||||||
|
for k, v := range headers {
|
||||||
|
req.Header.Set(k, v)
|
||||||
|
}
|
||||||
|
resp, err := http.DefaultClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,11 +87,16 @@ func (s *Server) feed(w http.ResponseWriter, r *http.Request) {
|
||||||
Copyright string `json:"copyright"`
|
Copyright string `json:"copyright"`
|
||||||
ContentFilter string `json:"content"`
|
ContentFilter string `json:"content"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
|
Headers map[string]string `json:"headers"`
|
||||||
}
|
}
|
||||||
if err := json.NewDecoder(r.Body).Decode(&putFeed); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&putFeed); err != nil {
|
||||||
s.userError(w, r, err)
|
s.userError(w, r, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if putFeed.Headers == nil {
|
||||||
|
putFeed.Headers = map[string]string{}
|
||||||
|
}
|
||||||
|
putFeedHeaders, _ := json.Marshal(putFeed.Headers)
|
||||||
interval, err := time.ParseDuration(putFeed.Interval)
|
interval, err := time.ParseDuration(putFeed.Interval)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.userError(w, r, err)
|
s.userError(w, r, err)
|
||||||
|
|
@ -104,6 +109,7 @@ func (s *Server) feed(w http.ResponseWriter, r *http.Request) {
|
||||||
ContentFilter: putFeed.ContentFilter,
|
ContentFilter: putFeed.ContentFilter,
|
||||||
Tags: putFeed.Tags,
|
Tags: putFeed.Tags,
|
||||||
Copyright: putFeed.Copyright,
|
Copyright: putFeed.Copyright,
|
||||||
|
Headers: putFeedHeaders,
|
||||||
}
|
}
|
||||||
if err := rss.SubmitFeed(f); err != nil {
|
if err := rss.SubmitFeed(f); err != nil {
|
||||||
s.error(w, r, err)
|
s.error(w, r, err)
|
||||||
|
|
|
||||||
|
|
@ -33,18 +33,10 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UC9YLd0REiXxLqQQH_CpJKZQ
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCsvn_Po0SmunchJYOWpOxMg youtube","videogamedunkey ".*" ".*" "6h"
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCsvn_Po0SmunchJYOWpOxMg youtube","videogamedunkey ".*" ".*" "6h"
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCs-w7E2HZWwXmjt9RTvBB_A youtube","settled ".*" ".*" "6h"
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCs-w7E2HZWwXmjt9RTvBB_A youtube","settled ".*" ".*" "6h"
|
||||||
https://roosterteeth.com/show/rt-podcast/feed/mp3 podcast ".*" ".*" "6h"
|
https://roosterteeth.com/show/rt-podcast/feed/mp3 podcast ".*" ".*" "6h"
|
||||||
https://eztv.ag/ezrss.xml?c=c momma","torrent "^NOT(d.Rush.*720.*WEB|Gold.Rush.*S.*E.*720.*WEB)" "<a.*?href=.magnet:.*?</a>" "2h" GoldRush
|
|
||||||
https://eztv.ag/ezrss.xml?e=e momma","torrent "^(Archer|The.Handmaids.Tale.*720.*WEB|Australian.Ninja.Warrior.*HDTV)" "<a.*?href=.magnet:.*?</a>" "2h"
|
|
||||||
https://eztv.ag/ezrss.xml?b=b momma","torrent "^(Survivor.S.*720p|[Ss]urvivor.*[AaSs][UuAa])" "<a.*?href=.magnet:.*?</a>" "2h" Survivor
|
|
||||||
http://lizclimo.tumblr.com/rss comic na na "24h"
|
http://lizclimo.tumblr.com/rss comic na na "24h"
|
||||||
https://eztv.ag/ezrss.xml?a=a momma","torrent "^abc123(Wheel.[oO]f.Fortune.[S2]|Jeopardy.20|[tT]he.[pP]rice.[iI]s.[rR]ight|[lL]et.*[mM]ake.[aA].[dD]eal)" "<a.*?href=.magnet:.*?</a>" "2h" GameShows
|
|
||||||
https://eztv.ag/ezrss.xml?d=d momma","torrent "([Mm]andalorian)" "<a.*?href=.magnet:.*?</a>" "2h" Mandalorian
|
|
||||||
http://feeds.feedburner.com/blogspot/sBff cooking ".*" ".*" "24h"
|
http://feeds.feedburner.com/blogspot/sBff cooking ".*" ".*" "24h"
|
||||||
https://jaiminisbox.com/reader/feeds/rss manga "olo.*eveling" ".*" "6h"
|
https://jaiminisbox.com/reader/feeds/rss manga "olo.*eveling" ".*" "6h"
|
||||||
https://eztv.ag/ezrss.xml?f=f momma","torrent "^([Vv]ikings.S)" "<a.*?href=.magnet:.*?</a>" "2h" Vikings
|
|
||||||
https://xkcd.com/atom.xml comic na na "24h"
|
https://xkcd.com/atom.xml comic na na "24h"
|
||||||
https://eztv.ag/ezrss.xml?g=g torrent","news "^([Ll]ast..eek..onight..ith..ohn..liver.*WEB)" "<a.*?href=.magnet:.*?</a>" "2h" LastWeekTonight
|
|
||||||
https://eztv.ag/ezrss.xml?h=h torrent "^([Rr]ick.[Aa]nd.[Mm]orty)" "<a.*?href=.magnet:.*?</a>" "2h" RickAndMorty
|
|
||||||
https://matrix.org/blog/feed news ".*" ".*" "1h"
|
https://matrix.org/blog/feed news ".*" ".*" "1h"
|
||||||
https://nyaa.si/?page=rss&f=0&c=0_0&q=shingeki+no+kyojin+final+season+720p anime","torrent ".*" ".*" "1h" Anime-ShingekiNoKyojin
|
https://nyaa.si/?page=rss&f=0&c=0_0&q=shingeki+no+kyojin+final+season+720p anime","torrent ".*" ".*" "1h" Anime-ShingekiNoKyojin
|
||||||
https://workchronicles.com/feed/ comic na na "4h"
|
https://workchronicles.com/feed/ comic na na "4h"
|
||||||
|
|
@ -52,11 +44,19 @@ https://nyaa.si/?page=rss&f=0&c=0_0&q=re+zero+2nd+part+erai+raws+720
|
||||||
https://www.webtoons.com/en/challenge/books-of-adam/rss?title_no=136637 comic na na "12h"
|
https://www.webtoons.com/en/challenge/books-of-adam/rss?title_no=136637 comic na na "12h"
|
||||||
https://www.webtoons.com/en/romance/the-makeup-remover/rss?title_no=2186 comic na na "12h"
|
https://www.webtoons.com/en/romance/the-makeup-remover/rss?title_no=2186 comic na na "12h"
|
||||||
https://www.webtoons.com/en/romance/truebeauty/rss?title_no=1436 comic na na "12h"
|
https://www.webtoons.com/en/romance/truebeauty/rss?title_no=1436 comic na na "12h"
|
||||||
https://eztv.ag/ezrss.xml?d=d cooking","torrent "^([Mm]aster[cC]hef.*720p.WEB|[Mm]aster[cC]hef.Aus.*)" "<a.*?href=.magnet:.*?</a>" "2h" MasterChef
|
|
||||||
https://subsplease.org/rss/?r=720 anime","torrent "^jfkaldsjfkldsjafd;sa" "<a.*?href=.magnet:.*?</a>" "2h" Anime
|
https://subsplease.org/rss/?r=720 anime","torrent "^jfkaldsjfkldsjafd;sa" "<a.*?href=.magnet:.*?</a>" "2h" Anime
|
||||||
|
https://eztv.ag/ezrss.xml?h=h torrent "^([Rr]ick.[Aa]nd.[Mm]orty)" "<a.*?href=.magnet:.*?</a>" "2h" RickAndMorty
|
||||||
|
https://eztv.ag/ezrss.xml?c=c momma","torrent "^NOT(d.Rush.*720.*WEB|Gold.Rush.*S.*E.*720.*WEB)" "<a.*?href=.magnet:.*?</a>" "2h" GoldRush
|
||||||
|
https://eztv.ag/ezrss.xml?e=e momma","torrent "^(Archer|The.Handmaids.Tale.*720.*WEB|Australian.Ninja.Warrior.*HDTV)" "<a.*?href=.magnet:.*?</a>" "2h"
|
||||||
|
https://eztv.ag/ezrss.xml?b=b momma","torrent "^(Survivor.S.*720p|[Ss]urvivor.*[AaSs][UuAa])" "<a.*?href=.magnet:.*?</a>" "2h" Survivor
|
||||||
|
https://eztv.ag/ezrss.xml?a=a momma","torrent "^abc123(Wheel.[oO]f.Fortune.[S2]|Jeopardy.20|[tT]he.[pP]rice.[iI]s.[rR]ight|[lL]et.*[mM]ake.[aA].[dD]eal)" "<a.*?href=.magnet:.*?</a>" "2h" GameShows
|
||||||
|
https://eztv.ag/ezrss.xml?d=d momma","torrent "([Mm]andalorian)" "<a.*?href=.magnet:.*?</a>" "2h" Mandalorian
|
||||||
|
https://eztv.ag/ezrss.xml?f=f momma","torrent "^([Vv]ikings.S)" "<a.*?href=.magnet:.*?</a>" "2h" Vikings
|
||||||
|
https://eztv.ag/ezrss.xml?g=g torrent","news "^([Ll]ast..eek..onight..ith..ohn..liver.*WEB)" "<a.*?href=.magnet:.*?</a>" "2h" LastWeekTonight
|
||||||
|
https://eztv.ag/ezrss.xml?d=d cooking","torrent "^([Mm]aster[cC]hef.*720p.WEB|[Mm]aster[cC]hef.Aus.*)" "<a.*?href=.magnet:.*?</a>" "2h" MasterChef
|
||||||
'
|
'
|
||||||
#https://eztv.ag/ezrss.xml momma","torrent "^(Wheel.[oO]f.Fortune.[S2]|Jeopardy.20|Gold.Rush.*720.*WEB|Survivor.S.*720p|Gold.Rush.*S.*E.*720.*WEB|Archer|[Mm]aster[cC]hef.US.*720p.WEB|[Mm]aster[cC]hef.Aus.*|[tT]he.[pP]rice.[iI]s.[rR]ight|[lL]et.*[mM]ake.[aA].[dD]eal|The.Handmaids.Tale.*720.*WEB|[Ss]urvivor.*[AaSs][UuAa]|Australian.Ninja.Warrior.*HDTV)" "<a.*?href=.magnet:.*?</a>" "2h"
|
#https://eztv.ag/ezrss.xml momma","torrent "^(Wheel.[oO]f.Fortune.[S2]|Jeopardy.20|Gold.Rush.*720.*WEB|Survivor.S.*720p|Gold.Rush.*S.*E.*720.*WEB|Archer|[Mm]aster[cC]hef.US.*720p.WEB|[Mm]aster[cC]hef.Aus.*|[tT]he.[pP]rice.[iI]s.[rR]ight|[lL]et.*[mM]ake.[aA].[dD]eal|The.Handmaids.Tale.*720.*WEB|[Ss]urvivor.*[AaSs][UuAa]|Australian.Ninja.Warrior.*HDTV)" "<a.*?href=.magnet:.*?</a>" "2h"
|
||||||
feedsB="$(printf "%s\n" "$feeds" | grep -v '^$' | tail -n 1)"
|
feedsB="$(printf "%s\n" "$feeds" | grep -v '^$' | tail -n 9)"
|
||||||
feeds="$feedsB"
|
feeds="$feedsB"
|
||||||
|
|
||||||
defaultIF='""'
|
defaultIF='""'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue