Created
March 31, 2016 06:43
-
-
Save vvscode/e733c92fadfd17f2462ed490754b27d2 to your computer and use it in GitHub Desktop.
Amazing Hiring parsing helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // In global NS to make debug more easier | |
| var PAGES_DELAY = 3000; | |
| var profiles = []; | |
| function step1() { | |
| console.log(`Process page: ${window.location}`); | |
| $('a[href*="/profile"]').toArray().forEach((a) => profiles.push(a.getAttribute('href'))); | |
| console.log(profiles.length, $('a[href*="/profile"]').length); | |
| if(!$('a.page-link.next').length) { | |
| return; | |
| } | |
| $('a.page-link.next').click(); | |
| setTimeout(step1, PAGES_DELAY); | |
| } | |
| function step2() { | |
| console.log('Clear profiles links'); | |
| profiles = profiles.filter(item => item.match(/id=(.+)/)).map(item => item.match(/id=(.+)/).pop()); | |
| step3(); | |
| } | |
| function step3() { | |
| if(!profiles.length) { | |
| return alert('Done'); | |
| } | |
| var url = profiles.pop(); | |
| console.log(`Url to open: ${url}`); | |
| window.open(url); | |
| setTimeout(step3, Math.random()*2000 + 1000); | |
| } | |
| function start() { | |
| console.clear(); | |
| console.log('Start process'); | |
| step1(); | |
| } | |
| start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment