expose Get methods
This commit is contained in:
parent
e542fa0c97
commit
e8cd6ab8c5
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/PuerkitoBio/goquery"
|
"github.com/PuerkitoBio/goquery"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (api *Api) getWithCookie(ctx context.Context, url string) (*goquery.Document, error) {
|
func (api *Api) GetWithCookie(ctx context.Context, url string) (*goquery.Document, error) {
|
||||||
if api.Cookie == "" {
|
if api.Cookie == "" {
|
||||||
return nil, errors.New("no API cookie set")
|
return nil, errors.New("no API cookie set")
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ func (api *Api) getWithCookie(ctx context.Context, url string) (*goquery.Documen
|
|||||||
return goquery.NewDocumentFromReader(r)
|
return goquery.NewDocumentFromReader(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) get(ctx context.Context, url string) (*goquery.Document, error) {
|
func (api *Api) Get(ctx context.Context, url string) (*goquery.Document, error) {
|
||||||
curl := exec.CommandContext(ctx, "curl",
|
curl := exec.CommandContext(ctx, "curl",
|
||||||
"-s", url,
|
"-s", url,
|
||||||
"-H", fmt.Sprintf("User-Agent: %s", api.UserAgent),
|
"-H", fmt.Sprintf("User-Agent: %s", api.UserAgent),
|
||||||
|
Loading…
Reference in New Issue
Block a user