Scrape list of keywords query
In the last section, we have learned how to define a recipe to scrape a list of URL, where we declared an argument on openURL action, and magical things happened!
In this section, we will show how to do batch keywords query and scraping.
Most commonly, we do not know the urls to scrape, but have a topic to research, and would like scrape data about the topic via related keywords. For example, we want to search iWatch's accessories. So we prepare a list of keywords:
Except the head, there are three data lines. Taking the first data line for example, we would like search iWatch charger, and scrape the listed items in the first 2 pages.
In the section Keywords search and scraping, we haved learned how to do keywords search and scrape result list. Here we can start from there, simply declare several arguments, and make the recipe dynamic!
Now open the recipe created in that section, extend the 'Input Text' action on Start node, click the star icon at the right of the input box.
Here we declare that the 'Input Text' action's text accepts argument.
Tips: here you can use the optional values to limit the argument values user can type in when starting the recipe. For example
The 'scroll_times' argument here accepts 1,2 and 3 only. When starting the recipe, the argument input will be a dropdown select box on Single Input UI. Then go to SearchResults Node, click the pages setting icon( ) under selected pagination mode.
Now we can click the star icon next to the input box, and declare an argument to tell that the 'pagination times' input accepts argument.
Now save and start the recipe on popup window.
The argument input tells that the recipe accepts two arguments, keyword and pages. Switching to Batch Input mode:
Here we paste all three arguments lines into the box.
You click the Start botton on the bottom of the popup dialog, and NDS will read each line and feed each argument on the line to the recipe. All scraped results are saved to 'amazon_keywords' data table.
Up to now you can make any recipe dynmaic to accept multiple arguments, and multiple argument lines to do repeating scraping easily.
In visual recipe creator, all input box with star icon accepts argument.
Instead of pasting argument list when starting a recipe, we can specify an data table as recipe's input. We will demonstrate it in the next section.
The following videos demonstrate how to configure arguments and enable list of URL scraping:
Note: once declaring data table as arugment input, all old arguments will be cleaned, and you have to map columns in the input table to argument input via Argument Setting UI again.