Documentation
¶
Index ¶
- Constants
- type Article
- type HTTPClient
- type Profile
- type Scholar
- func (sch *Scholar) QueryArticle(url string, article *Article, dumpResponse bool) (*Article, error)
- func (sch *Scholar) QueryProfile(user string, limit int) ([]*Article, error)
- func (sch *Scholar) QueryProfileDumpResponse(user string, queryArticles bool, limit int, dumpResponse bool) ([]*Article, error)
- func (sch *Scholar) QueryProfileWithMemoryCache(user string, limit int) ([]*Article, error)
- func (sch *Scholar) SaveCache(profileCache string, articleCache string)
- func (sch *Scholar) SetHTTPClient(client HTTPClient)
- func (sch *Scholar) SetRequestDelay(delay time.Duration)
Constants ¶
View Source
const AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0"
View Source
const BaseURL = "https://scholar.google.com"
View Source
const MAX_TIME_ARTICLE = time.Second * 3600 * 24 * 30 // 30 days
View Source
const MAX_TIME_PROFILE = time.Second * 3600 * 24 * 7 // 1 week
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Title string
Authors string
ScholarURL string
Year int
Month int
Day int
NumCitations int
Articles int // if there are more than one article within this publication (it will also tell how big the arrays below are)
Description string
PdfURL string
Journal string
Volume string
Pages string
Publisher string
ScholarCitedByURLs []string
ScholarVersionsURLs []string
ScholarRelatedURLs []string
LastRetrieved time.Time
}
type HTTPClient ¶ added in v1.0.10
HTTPClient interface to allow mocking of HTTP requests
type Scholar ¶
type Scholar struct {
// contains filtered or unexported fields
}
func (*Scholar) QueryArticle ¶
func (*Scholar) QueryProfile ¶
func (*Scholar) QueryProfileDumpResponse ¶
func (sch *Scholar) QueryProfileDumpResponse(user string, queryArticles bool, limit int, dumpResponse bool) ([]*Article, error)
QueryProfileDumpResponse queries the profile of a User and returns a list of Articles if queryArticles is true, it will also query the Articles for extra information which isn't present on the profile page
we may wish to set this to false if we are only interested in some article info, or we have a cache hit and we just want to get updated information from the profile page only to save requests
if dumpResponse is true, it will print the response to stdout (useful for debugging)
func (*Scholar) QueryProfileWithMemoryCache ¶ added in v1.0.5
func (*Scholar) SetHTTPClient ¶ added in v1.0.10
func (sch *Scholar) SetHTTPClient(client HTTPClient)
SetHTTPClient allows setting a custom HTTP client (useful for testing)
func (*Scholar) SetRequestDelay ¶ added in v1.0.10
SetRequestDelay allows setting a custom delay between requests for throttling
Click to show internal directories.
Click to hide internal directories.