Documentation ¶
Overview ¶
Example ¶
// create Query and generate URL q := Query{Keywords: "nature 2015", Author: "y bengio", Title: "Deep learning"} url := q.SearchUrl() // fetch document sending the request to the URL doc, err := Fetch(url) if err != nil { log.Error(err) return } // parse articles ch := make(chan *Article, 10) go ParseDocument(ch, doc) for a := range ch { fmt.Println("---") fmt.Println(a) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var (
USER_AGENT = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"
)
Functions ¶
func Fetch ¶ added in v0.1.0
Fetch gets a Document from a given URL. For usage, see the example of Overview.
func ParseDocument ¶ added in v0.1.0
ParseDocument sends the pointers of parsed Articles to the given channel. The channel will be closed if there are no articles to be sent.
Types ¶
type Article ¶
type Article struct { Title *Title `json:"title"` Year string `json:"year"` ClusterId string `json:"cluster_id"` NumCite string `json:"num_cite"` NumVer string `json:"num_ver"` InfoId string `json:"info_id"` Link *Link `json:"link"` BibTeX string `json:"bibtex"` Author []string `json:"author"` Journal string `json:"journal"` Booktitle string `json:"booktitle"` Volume string `json:"volume"` Number string `json:"number"` Pages string `json:"pages"` Publisher string `json:"publisher"` }
Article stores the parsed results from Google Scholar.
func ParseSelection ¶ added in v0.1.0
ParseSelection returns a parsed Article. If the Article is not valid (e.g., Author profile), it returns error.
type Link ¶ added in v0.1.0
type Link struct { Name string `json:"name"` Url string `json:"url"` Format string `json:"format"` }
Link is an attribute of Article
type Query ¶ added in v0.1.0
type Query struct { Keywords string Author string Title string ClusterId string InfoId string After string Before string Num string Start string }
Query issue an appropriate URL to which Fetch sends a request.
func (*Query) CitePopUpQueryUrl ¶ added in v0.1.0
CitePopUpQueryUrl issues a URL used for getting BibTeX information. This only uses the InfoId. For example:
https://scholar.google.co.jp/scholar?q=info:XOJff8gPiHAJ:scholar.google.com/&output=cite&scirp=0&hl=en
func (*Query) CiteUrl ¶ added in v0.1.0
CiteUrl uses ClusterId and issues the URL whose results include the articles citing the article of the ClusterId. This depends on ClusterId, After, Before, Num and Start. For example:
https://scholar.google.co.jp/scholar?hl=en&cites=5362332738201102290&as_ylo=2012&as_yhi=&num=40&start=20
func (*Query) FindUrl ¶ added in v0.1.0
FindUrl uses ClusterId which identify the desired article and spits out URL like:
https://scholar.google.co.jp/scholar?hl=en&cluster=5362332738201102290&num=1
FindUrl depends only on ClusterId
func (*Query) SearchUrl ¶ added in v0.1.0
SearchUrl issues URL whose search query is composed of keywords, author and title. SearchUrl uses Keywords, Author, Title, After, Before, Num and Start Attributes. For example:
https://scholar.google.co.jp/scholar?hl=en&q=deep+learning+author:"y+bengio"&as_ylo=2015&as_yhi=&num=100&start=20