Yuri Posted July 12, 2017 Share Posted July 12, 2017 (edited) Hello everyone! I have link https://www.shutterstock.com/search?searchterm=test&sort=popular&image_type=all&search_source=base_landing_page&language=en&page=1 The question is, how can I go to the page=2 https://www.shutterstock.com/search?searchterm=test&sort=popular&image_type=all&search_source=base_landing_page&language=en&page=2, and page 2+1=3, https://www.shutterstock.com/search?searchterm=test&sort=popular&image_type=all&search_source=base_landing_page&language=en&page=3, and page 3+1=4, https://www.shutterstock.com/search?searchterm=test&sort=popular&image_type=all&search_source=base_landing_page&language=en&page=4, and page 4+1=5 ... , etc ... on the same tab on Safari, with shortcut? It will save a lot of time. Thank you for any help! Edited July 12, 2017 by Yuri Link to comment
vitor Posted July 17, 2017 Share Posted July 17, 2017 (edited) const browser = Application('Safari') const current_tab_url = browser.documents[0].url() const base_url = current_tab_url.substring(0, current_tab_url.lastIndexOf('=') + 1) const current_number = current_tab_url.substring(current_tab_url.lastIndexOf('=') + 1, current_tab_url.length) const next_number = Number(current_number) + 1 if (isNaN(next_number)) { browser.documents[0].url = current_tab_url + '&page=2' } else { browser.documents[0].url = base_url + next_number } Edited July 21, 2017 by vitor Yuri 1 Link to comment
Yuri Posted July 20, 2017 Author Share Posted July 20, 2017 Thank you Vitor! It works perfect Link to comment
Yuri Posted July 21, 2017 Author Share Posted July 21, 2017 I have one more situation. When I search by keyword "test" first, it looks like this: https://www.shutterstock.com/search?searchterm=test&sort=popular&image_type=all&search_source=base_landing_page&language=en, without &page=1 but without this, the workflow doesn't work. How to add a suffix so that it works from the first page, or maybe it has another way? Link to comment
vitor Posted July 21, 2017 Share Posted July 21, 2017 I’ve updated the code in the previous reply. Here’s the updated Workflow. If it cannot find a number at the end of the URL, it’ll just append &page=2. Yuri 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now