示例#1
0
func (this bing_search) SpellingSuggestion(params BingSearchParameters) (curl.Cache, error) {
	params.Format = new_string(SearchResultFormatJson)
	q := oauth2.HttpQueryEncode(params)
	c := curl.NewCurlerDetail(this.temp_folder, curl.CurlProxyPolicyNoProxy, 0, this, nil)
	x := BingSearchServiceRoot + ServiceOperationSpellingSuggestion + "?" + q
	return c.Get(x)
}
示例#2
0
func (this pubsuber) Retrieve(uri string, count int) (string, error) {
	p := struct {
		mode   string `param:"hub.mode"`
		topic  string `param:"hub.topic"`
		count  int    `param:"count"`
		format string `param:"format"`
	}{"retrieve", uri, count, "json"}
	u := this.service_provider + "?" + oauth2.HttpQueryEncode(p)
	return curl.NewCurlerDetail("", this.proxy_policy, 0, nil, nil).GetAsString(u)
}
示例#3
0
func BingSuggestion(q string) ([]string, error) {
	p := struct {
		market string `param:"mkt"` //zh-CN
		cp     int    `param:"cp"`  //2
		o      string `param:"o"`   //a+ds+ds+p
		query  string `param:"q"`
	}{market: "zh-CN", cp: 2, query: q}

	qu := oauth2.HttpQueryEncode(p)
	uri := bing_suggest + "?" + qu
	var val bing_suggestion_result
	err := curl.NewCurl("").GetAsJson(uri, &val)
	x := export_bing_suggestions(val)
	return x, err
}
示例#4
0
func (this google_feedapi) Find(q, hl string) ([]feed.FeedEntity, error) {
	p := struct {
		q  string `param:"q"`
		hl string `param:"hl"` // default en, nil means en
		v  string `param:"v"`
	}{q: q, hl: hl, v: "1.0"}
	v := find_result{}
	uri := find_url + "?" + oauth2.HttpQueryEncode(p)
	c := curl.NewCurlerDetail(this.temp_folder, curl.CurlProxyPolicyAlwayseProxy, 0, this, nil)
	err := c.GetAsJson(uri, &v)
	if err != nil {
		return nil, err
	}
	x, err := v.to_feedentities()
	return x, err
}
示例#5
0
func So360Suggestion(q string) ([]string, error) {
	p := struct {
		callback  string `param:"callback"`
		encodein  string `param:"encodein"`
		encodeout string `param:"encodeout"`
		word      string `param:"word"`
	}{word: q, encodein: "utf-8", encodeout: "utf-8"}
	qu := oauth2.HttpQueryEncode(p)
	uri := so360_suggest + "?" + qu
	fmt.Println(uri)
	/*	val := struct {
			Q string   `json:"q"`
			P bool     `json:"p"`
			S []string `json:"s"`
		}{}
	*/
	_, err := curl.NewCurl("", curl.CurlProxyPolicyNoProxy, 0).GetAsString(uri)
	return nil, err
}
示例#6
0
func (this google_feedapi) Load(uri, hl string, num int, scoring bool) (feed.FeedEntity, error) {
	p := struct {
		q       string `param:"q"`
		hl      string `param:"hl"`      // default en
		num     *int   `param:"num"`     // default 4
		scoring string `param:"scoring"` // nil or h
		v       string `param:"v"`
	}{q: uri, hl: hl, num: make_num(num), scoring: make_scoring(scoring), v: "1.0"}
	c := curl.NewCurlerDetail(this.temp_folder, curl.CurlProxyPolicyAlwayseProxy, 0, this, nil)
	v := load_result{}
	url := load_url + "?" + oauth2.HttpQueryEncode(p)
	err := c.GetAsJson(url, &v)

	if err != nil {
		return feed.FeedEntity{}, err
	}
	s, err := v.to_feedentity()
	return s, err
}
示例#7
0
func BaiduSuggestion(q string) ([]string, error) {
	p := struct {
		query    string `param:"wd"`
		callback string `param:"cb"`
		sid      string `param:"sid"`
		t        string `param:"t"`
		p        *int   `param:"p"`
	}{query: q}
	qu := oauth2.HttpQueryEncode(p)
	uri := baidu_suggest + "?" + qu
	fmt.Println(uri)
	/*	val := struct {
			Q string   `json:"q"`
			P bool     `json:"p"`
			S []string `json:"s"`
		}{}
	*/
	_, err := curl.NewCurl("", curl.CurlProxyPolicyNoProxy, 0).GetAsString(uri)
	x := make([]string, 0)
	return x, err
}
示例#8
0
func (this bing_search) Composite(params BingSearchCompositeParameters) (curl.Cache, error) {
	q := oauth2.HttpQueryEncode(params)
	c := curl.NewCurlerDetail(this.temp_folder, curl.CurlProxyPolicyNoProxy, 0, this, nil)
	return c.Get(BingSearchServiceRoot + ServiceOperationComposite + "?" + q)
}
示例#9
0
func (this googlefeedapi_load_param) build() string {
	return oauth2.HttpQueryEncode(this)
}