URL Variations
Posted: Thu Apr 05, 2018 4:39 am
This is a quick way to generate a list of URLs when a number in the URL is the only thing that changes, typically the page number or the starting item, such as in this example:
To load the output URLs, right click the new action and select Output Result, and then give a descriptive name to the output variable, such as url. Then, add a Browser.Load action and pass this variable as the argument.
The following example will generate the 3 URLs on the list above and navigate to each of them. This example assumes you've already pasted the code above and called it Variations:
- https://www.google.com/search?q=helium+scraper&start=50
- https://www.google.com/search?q=helium+scraper&start=60
- https://www.google.com/search?q=helium+scraper&start=70
- url: The base URL. Must contain a @ symbol to be replaced with each number.
- start: The starting number.
- step: The step between each number.
- count: The number of URLs to generate.
Code: Select all
function (url start step count)
Sequence.FromValues
· List.Range
· 0
· count
as index
return
· String.Replace
· url
· "@"
· Core.ToString
· +
· start
· *
· step
· index
The following example will generate the 3 URLs on the list above and navigate to each of them. This example assumes you've already pasted the code above and called it Variations:
Code: Select all
Variations
· "https://www.google.com/search?q=helium+scraper&start=@"
· 50
· 10
· 3
as url
Browser.Load
· url