The starting value allows you to add your own list of data that you can use in your project. You can change this under the "Settings" tab of your project.
You can use this text box to:
- Add a list of urls for ParseHub to crawl through
- Add keywords that you want ParseHub to enter into a search box
- Add usernames and passwords that ParseHub will enter into a log-in screen
- Add multiple values for one set of data
Tutorial:
In this example we will enter hypothetical movie urls into ParseHub and also add a price that corresponds to each url into the starting value.
1. Open ParseHub and add in the following url - https://www.parsehub.com/sandbox/welcome2
2. Open the "Settings" tab of the project.
3. There are two ways that you can add your list into the Starting Value textbox:
- Use the "Import from CSV/JSON" option to import a list of values from a CSV file
- If you are familiar with JSON, paste your JSON directly into the textbox
If you have a CSV file called "movies.csv" with two columns (one called "url" and one called "price") such as the one below, using the "Import from CSV/JSON" option to select that file will import your list as follows:
If you are more comfortable working with JSON, you can always enter the JSON list directly into the textbox:
{
"movies":[
{"url":"https://www.parsehub.com/sandbox/moviedetailsimple?movie=The%20Shawshank%20Redemption","price":"$9.99 "},
{"url":"https://www.parsehub.com/sandbox/moviedetailsimple?movie=Schindler%27s%20List","price":"$10.99 "}
]
}
7. Click on the + button on the right side of the "For each item in movies" command.
8. From the tool box choose the "Begin New Entry" tool.
9. Rename the "list1" command to something else like "movie". Make sure not to name the Begin new entry command the same as the list that holds your movies. The begin new entry command should have a unique name.
10. Click on the + button on the right side of the "Begin new entry in movie" command.
11. Choose the "Extract" command from the tool box. This will let you extract anything you put in the text box of the extract command into your results.
12. In the text box below the dropdown, type in "item.price". Now the price you entered in the "Starting value" for each url will be extracted into your results.
13. Click on the + button on the right side of the "Begin new entry in movie" command or if you didn't rename it the "Begin new entry in list1" command.
14. Choose the "Go To Template" from the tool box. The Go to Template command will let you specify which url you want to go to and which type of page you want to open.
15. On the pop up window choose "Go to URL :" instead of "Stay on the Same Page".
16. In the text box type in "item.url" without quotation marks. Enter the new template's name in the "Create New Template" text box and click on "Create New Template." A new template will open for you with the new url.