MCPcopy Create free account
hub / github.com/algolia/cli / CrawlURLs

Method CrawlURLs

api/crawler/client.go:287–313  ·  view source on GitHub ↗

CrawlURLs crawls the specified URLs on the specified Crawler. It returns the Task ID if successful.

(
	crawlerID string,
	URLs []string,
	save, saveSpecified bool,
)

Source from the content-addressed store, hash-verified

285// CrawlURLs crawls the specified URLs on the specified Crawler.
286// It returns the Task ID if successful.
287func (c *Client) CrawlURLs(
288 crawlerID string,
289 URLs []string,
290 save, saveSpecified bool,
291) (string, error) {
292 var res TaskIDResponse
293 path := fmt.Sprintf("crawlers/%s/urls/crawl", crawlerID)
294
295 var body interface{}
296 if saveSpecified {
297 body = struct {
298 URLs []string `json:"urls"`
299 Save bool `json:"save"`
300 }{URLs, save}
301 } else {
302 body = struct {
303 URL []string `json:"urls"`
304 }{URLs}
305 }
306
307 err := c.request(&res, http.MethodPost, path, body, nil)
308 if err != nil {
309 return "", err
310 }
311
312 return res.TaskID, nil
313}
314
315// Test tests an URL on the specified Crawler.
316func (c *Client) Test(crawlerID, URL string, config *Config) (*TestResponse, error) {

Callers 1

runCrawlCmdFunction · 0.80

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected