func (c *Client) extract(urls []string, options Options) ([]Response, error) {
	addr := Host + "/1/extract?"
	for i, u := range urls {
		urls[i] = url.QueryEscape(u)
	}
	if len(urls) == 0 {
		return nil, errors.New("At least one URL is required")
	} else {
		for _, url := range urls {
			if len(url) == 0 {
				return nil, errors.New("A URL cannot be empty")
			}
		}
		addr += "urls=" + strings.Join(urls, ",")
	}

	v := url.Values{}
	v.Add("key", c.key)
	addInt(&v, "maxwidth", options.MaxWidth)
	addInt(&v, "maxheight", options.MaxHeight)
	addInt(&v, "words", options.Words)
	addInt(&v, "chars", options.Chars)
	addBool(&v, "wmode", options.WMode)
	addBool(&v, "allowscripts", options.AllowScripts)
	addBool(&v, "nostyle", options.NoStyle)
	addBool(&v, "autoplay", options.Autoplay)
	addBool(&v, "videosrc", options.VideoSrc)
	addBool(&v, "frame", options.Frame)
	addBool(&v, "secure", options.Secure)

	// Make the request.
	addr += "&" + v.Encode()
	resp, err := http.Get(addr)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	if resp.StatusCode >= 500 {
		body, _ := ioutil.ReadAll(resp.Body)
		return nil, fmt.Errorf("Got non 200 status code: %s %q", resp.Status, body)
	}

	// Read the JSON message from the body.
	response := []Response{}
	decoder := json.NewDecoder(resp.Body)
	if err := decoder.Decode(&response); err != nil {
		return nil, err
	}
	return response, nil
}
// extract will call extract 10 urls at max.
extract will call extract 10 urls at max.
// extract will call extract 10 urls at max .
func (c *Client) extract(urls []string, options Options) ([]Response, error) {
	addr := Host + "/1/extract?"
	for i, u := range urls {
		urls[i] = url.QueryEscape(u)
	}
	if len(urls) == 0 {
		return nil, errors.New("At least one URL is required")
	} else {
		for _, url := range urls {
			if len(url) == 0 {
				return nil, errors.New("A URL cannot be empty")
			}
		}
		addr += "urls=" + strings.Join(urls, ",")
	}
	v := url.Values{}
	v.Add("key", c.key)
	addInt(&v, "maxwidth", options.MaxWidth)
	addInt(&v, "maxheight", options.MaxHeight)
	addInt(&v, "words", options.Words)
	addInt(&v, "chars", options.Chars)
	addBool(&v, "wmode", options.WMode)
	addBool(&v, "allowscripts", options.AllowScripts)
	addBool(&v, "nostyle", options.NoStyle)
	addBool(&v, "autoplay", options.Autoplay)
	addBool(&v, "videosrc", options.VideoSrc)
	addBool(&v, "frame", options.Frame)
	addBool(&v, "secure", options.Secure)
	addr += "&" + v.Encode()
	resp, err := http.Get(addr)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	if resp.StatusCode >= 500 {
		body, _ := ioutil.ReadAll(resp.Body)
		return nil, fmt.Errorf("Got non 200 status code: %s %q", resp.Status, body)
	}
	response := []Response{}
	decoder := json.NewDecoder(resp.Body)
	if err := decoder.Decode(&response); err != nil {
		return nil, err
	}
	return response, nil
}
func ( c * Client ) extract ( urls [ ] string , options Options ) ( [ ] Response , error ) { addr := Host + " " for i , u := range urls { urls [ i ] = url . QueryEscape ( u ) } if len ( urls ) == 0 { return nil , errors . New ( " " ) } else { for _ , url := range urls { if len ( url ) == 0 { return nil , errors . New ( " " ) } } addr += " " + strings . Join ( urls , " " ) } v := url . Values { } v . Add ( " " , c . key ) addInt ( & v , " " , options . MaxWidth ) addInt ( & v , " " , options . MaxHeight ) addInt ( & v , " " , options . Words ) addInt ( & v , " " , options . Chars ) addBool ( & v , " " , options . WMode ) addBool ( & v , " " , options . AllowScripts ) addBool ( & v , " " , options . NoStyle ) addBool ( & v , " " , options . Autoplay ) addBool ( & v , " " , options . VideoSrc ) addBool ( & v , " " , options . Frame ) addBool ( & v , " " , options . Secure ) addr += " " + v . Encode ( ) resp , err := http . Get ( addr ) if err != nil { return nil , err } defer resp . Body . Close ( ) if resp . StatusCode >= 500 { body , _ := ioutil . ReadAll ( resp . Body ) return nil , fmt . Errorf ( " " , resp . Status , body ) } response := [ ] Response { } decoder := json . NewDecoder ( resp . Body ) if err := decoder . Decode ( & response ) ; err != nil { return nil , err } return response , nil }
extract will call extract 10 urls at max.
extract will call extract 10 urls at max .
// Make the request. // Read the JSON message from the body.