mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
feat: add import list & calendar
This commit is contained in:
31
pkg/importlist/douban/douban.go
Normal file
31
pkg/importlist/douban/douban.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package douban
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
)
|
||||
|
||||
type DoulistItem struct {
|
||||
Name string
|
||||
ImdbID string
|
||||
}
|
||||
|
||||
func ParseDoulist(doulistUrl string) ([]DoulistItem, error) {
|
||||
res, err := http.Get(doulistUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("status code error: %d %s", res.StatusCode, res.Status)
|
||||
|
||||
}
|
||||
doc, err := goquery.NewDocumentFromReader(res.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
doc.Find("")
|
||||
return nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user