look for magenets in link too
parent
3de97bf7e8
commit
84170b443d
|
|
@ -119,7 +119,7 @@ func pull(db storage.DB, vpntor, outdir, url string) error {
|
|||
if item.Author == nil {
|
||||
item.Author = &gofeed.Person{Name: "."}
|
||||
}
|
||||
if err := handle(vpntor, path.Join(outdir, item.Author.Name), s); err != nil {
|
||||
if err := handle(vpntor, path.Join(outdir, item.Author.Name), item.Link, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := db.Set(item.Link, []byte{}); err != nil {
|
||||
|
|
@ -166,9 +166,9 @@ func isDone(db storage.DB, url string) (bool, error) {
|
|||
return true, err
|
||||
}
|
||||
|
||||
func handle(vpntor, outdir, content string) error {
|
||||
log.Printf("magnets: %v", findMagnets(content))
|
||||
for _, magnet := range findMagnets(content) {
|
||||
func handle(vpntor, outdir, link, content string) error {
|
||||
log.Printf("magnets: %v", append(findMagnets(content), findMagnets(link)...))
|
||||
for _, magnet := range append(findMagnets(content), findMagnets(link)...) {
|
||||
resp, err := submit(vpntor, outdir, magnet)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -244,6 +244,10 @@ func TestFindMagnets(t *testing.T) {
|
|||
s: `here is a link https://my.domain/a.b/c.torrent, and another <a href="https://my.domain/a/b/c.torrent"></a>`,
|
||||
l: 2,
|
||||
},
|
||||
{
|
||||
s: `https://my.domain/a.b/c.torrent`,
|
||||
l: 1,
|
||||
},
|
||||
}
|
||||
|
||||
for i, c := range cases {
|
||||
|
|
|
|||
Loading…
Reference in New Issue