Enter multiple keywords into a search box

With ParseHub you can add a list of keywords to be searched through into a search box. You don't have to manually add one keyword at a time, or wait for your project to finish for one keyword before changing it to another.

In this tutorial, we'll show you how you can add a list of keywords in JSON format into the Starting Value of the project in the Settings tab, and search for each of them to scrape the results.

For this tutorial we will use - http://www.amazon.com/ as an example. You can follow along using Amazon or you can apply the instructions to your own website and search form.

If you only need to input a single keyword into a search box, follow the instructions in this tutorial.

Entering multiple keywords

1. Open your project and any webpage of the website. Click "New Project" from the desktop app. When you enter the right url click "Start project on this URL".

2.  Go under the "Settings" tab of the project.

3. In the "Starting value" text box add in your keywords in the following format. The list "keywords" can be named whatever you want such as "terms" or "brands". The keywords such as "Barbie Dolls" can also be replaces with your own terms.

{"keywords":["Barbie Dolls","Bratz Dolls","Disney Dolls"]}
 
 
4. Go back to the "Commands" tab of your project.
 
5. Click on the + button on the right side of the "Select page" command.
 
 
6. Click the "Advanced" arrow to show more tools.
 
7. From the tool box choose the "Loop" tool. The loop tool iterates through a list, and is good for repeating commands multiple times.
  
 
8. In the text boxes - leave "item" and type in "keywords" or "products" in the list text box (without the quotation marks).
  • You can change "item" to anything you want. The item represents one url in your list of urls.
  • Make sure the the list name is exactly the same as your list name in JSON. If you typed in {"urls":....} make sure to keep the text in the text box as urls.

 

9. Click on the + button on the right side of the "For each item in keywords" command. Click on the "Advanced" arrow to show all of the tools.

10. From the tool box choose the "Begin New Entry" tool. Now the results for each one of the keywords will go into a separate row in Excel and a separate scope in JSON. If you don't use the list tool anywhere in your project, the results scraped for each keyword will over-ride one another. 

 

11. Rename the "list1" command to something else like "brands". Make sure not to name the list command the same as the list that holds your keywords. The list command should have a unique name. 

12. Click on the + button on the right side of the "brands" command or if you didn't rename it the "list1" command.

13. From the tool box select the "Select" tool.

 

14. Click on the search box. Automatically the input command will be created for you.

15. Instead of typing the actual keyword, just type in "item". This will tell ParseHub to add in the keyword that is represented by the item in the list of your brands.

 

16. From the input command options, select "Expression" from the dropdown. ParseHub will read the text as an expression instead of just plain text.

17. Optional: Now you have an option to extract each keyword in your list along with the related results. This step will add a new column for the keywords that you provided as the starting value. 

Click on the + button on the right side of the "brands" command or if you didn't rename it the "list1" command and choose the Extract command. Instead of $location.href enter item and rename the Extract command to "searchterm". In your final results you will have a column which extracts the associated keyword per each result.

 

 

18. Click on the + button on the right side of the "brands" command or if you didn't rename it the "list1" command.

19. From the tool box select the "Select" tool.

 

20. Now, click on the search button on the page. A selection command should appear for you.

 

21. Click on the + button on the selection that you just made. Click on the "Advanced" option to show all of the tools.

22. From the tool box choose the "Click" tool. The click tool let's you click on anything on the page to open drop downs, tabs, etc or to click on buttons that will take you to another page. 

23. In the pop-up select the "Create New Template" option. Clicking on the button will product a new page of results, therefore, you should be creating a new template to make a new set of instructions. Remember, you should use a new template for every page that looks different.

24. In the text-box in the pop-up type in "products" and click "Create New Template". A new template should be created for you. 

25. On the new template you can go ahead and select and extract any of the results that you want to scrape. ParseHub will repeat the instruction of searching for the keyword and scraping results for all of the keywords you added into the "Starting value".