-
Notifications
You must be signed in to change notification settings - Fork 1
/
playstore.go
33 lines (27 loc) · 958 Bytes
/
playstore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// The playstore package lets you query the Google Play Store (Android Market).
// It basically provides two ways of querying. LookUp lets you find an app by
// id and the search method lets you find apps by search terms.
package playstore
import (
"github.com/PuerkitoBio/goquery"
"net/http"
"net/url"
)
// Prototype for an http request.
type httpGetFunc func(url *url.URL) (*http.Response, error)
type playStoreDocument struct {
document *goquery.Document
}
const ENDPOINT = "play.google.com/store"
// Constructs a new document wrapping goquery.document
func NewPlayStoreDocument(response *http.Response) (*playStoreDocument, error) {
document, err := goquery.NewDocumentFromResponse(response)
if err != nil {
return nil, err
}
return &playStoreDocument{document}, nil
}
// A wrapper for the goquery find method.
func (document *playStoreDocument) Find(selection string) (s *goquery.Selection) {
return document.document.Find(selection)
}