├── README.md ├── useThisOne.js ├── stuff copy.js └── originalTemplate.js /README.md: -------------------------------------------------------------------------------- 1 |

Automate LinkedIn Endorsements!

2 |

Save your click-finger!

3 | 4 | A way to automate endorsing others on linkedin: we might improve on this so maybe updates 5 | for now it automatically endorses the skills: 6 | First shout-out to our devs team: 7 | Christopher Carney, 8 | David Bernstein ([@dangitbobbeh](https://github.com/dangitbobbeh)), 9 | Timeo ([@timeowilliams](https://github.com/timeowilliams)), 10 | and me ([@WeilanCui](https://github.com/WeilanCui)), 11 | 18 | -------------------------------------------------------------------------------- /useThisOne.js: -------------------------------------------------------------------------------- 1 | // automates Linkedin skill promoting process 2 | //copy and paste all below into Chrome console 3 | async function dropmein() { 4 | const SCROLL_TIMEOUT = 600; 5 | const showMoreDiv = document.getElementsByClassName( 6 | "pv-profile-section__card-action-bar pv-skills-section__additional-skills artdeco-container-card-action-bar artdeco-button artdeco-button--tertiary artdeco-button--3 artdeco-button--fluid artdeco-button--muted pv-skills-section__additional-skills--mercado" 7 | ); 8 | 9 | let buttons = document.getElementsByClassName( 10 | "pv-skill-entity__featured-endorse-button-shared artdeco-button artdeco-button--circle artdeco-button--muted artdeco-button--1 artdeco-button--secondary ember-view") 11 | 12 | async function singleScroll() { 13 | if (await showMoreDiv) { 14 | return new Promise((resolve) => { 15 | setTimeout(() => { 16 | window.scrollTo(0, document.body.scrollHeight); 17 | resolve(); 18 | }, SCROLL_TIMEOUT); 19 | }); 20 | } 21 | } 22 | 23 | async function singleClick(elem) { 24 | return new Promise((resolve) => { 25 | setTimeout(() => { 26 | console.log("elem: ", elem) 27 | elem.click(); 28 | resolve(); 29 | }, 500); 30 | }); 31 | } 32 | 33 | async function bulkClick() { 34 | let elements = buttons; 35 | console.log("elements length:", elements.length); 36 | for (let i = 0; i < elements.length; i++) { 37 | await singleClick(elements[i]); 38 | console.log("click!"); 39 | } 40 | } 41 | await bulkClick(buttons); 42 | await bulkClick(buttons); 43 | await bulkClick(buttons); 44 | 45 | } 46 | dropmein() 47 | -------------------------------------------------------------------------------- /stuff copy.js: -------------------------------------------------------------------------------- 1 | function moreConnectionsPlease() { 2 | // maximum limit of Connect buttons clicked 3 | const LIMIT = 500; 4 | // wait in ms before each scroll 5 | const SCROLL_TIMEOUT = 600; 6 | // bulk scroll will scroll this amount of times 7 | const BULK_SCROLL_COUNT = 15; 8 | // wait in ms before each click 9 | const CLICK_DELAY = 300; 10 | // if this amount of connections in the page, time to click 11 | const MINIMUM_CONNECTS_TO_CLICK = 60; 12 | // if this amount of connections in the page, time to scroll 13 | const MINIMUM_CONNECTS_TO_SCROLL = 10; 14 | 15 | var connects = 0; 16 | var fails = 0; 17 | 18 | // 25 | // retrieves array "Connect" buttons 26 | function selectButtonElements() { 27 | const buttons = document.getElementsByClassName( 28 | "pv-skill-entity__featured-endorse-button-shared artdeco-button artdeco-button--circle artdeco-button--muted artdeco-button--1 artdeco-button--secondary ember-view" 29 | ); 30 | return buttons; 31 | } 32 | 33 | // scrolls to the bottom of the page 34 | // async function singleScroll() { 35 | // return new Promise(resolve => { 36 | // setTimeout(() => { 37 | // window.scrollTo(0, document.body.scrollHeight); 38 | // console.log("scroll!"); 39 | // resolve(); 40 | // }, SCROLL_TIMEOUT); 41 | // }); 42 | // } 43 | 44 | // delays an html element click 45 | // async function singleClick(elem) { 46 | // return new Promise(resolve => { 47 | // setTimeout(() => { 48 | // elem.click(); 49 | // resolve(); 50 | // }, CLICK_DELAY); 51 | // }); 52 | // } 53 | 54 | // // scroll to the bottom of the page several times 55 | // async function bulkScroll() { 56 | // for (let i = 0; i < BULK_SCROLL_COUNT; i++) { 57 | // await singleScroll(); 58 | // } 59 | // } 60 | 61 | // click on all but a few Connect buttons 62 | 63 | function bulkClick() { 64 | let elements = selectButtonElements(); 65 | console.log("elements length:", elements.length); 66 | for (let i = 0; i < elements.length; i++) { 67 | try { 68 | elem.click(elements[i]); 69 | console.log("click!"); 70 | connects++; 71 | } catch (err) { 72 | fails++; 73 | } 74 | } 75 | } 76 | 77 | bulkClick(); 78 | // // the list of people to connect to must keep a minimum amount of people 79 | // function isManyConnects(amount) { 80 | // return selectButtonElements().length >= amount; 81 | // } 82 | 83 | // do { 84 | // if (isManyConnects(MINIMUM_CONNECTS_TO_CLICK)) { 85 | // console.log("There are plenty of connections, time to click..."); 86 | // await bulkClick();} 87 | // // else { 88 | // // console.log("Out of connections, need to scroll..."); 89 | // // await bulkScroll(); 90 | // // } 91 | // console.log(`New Connections:${connects} Failed clicks:${fails}`); 92 | // } while (connects < LIMIT); 93 | console.log("[hits, fails]: ", [connects, fails]); 94 | } 95 | 96 | moreConnectionsPlease(); 97 | -------------------------------------------------------------------------------- /originalTemplate.js: -------------------------------------------------------------------------------- 1 | async function moreConnectionsPlease() { 2 | // maximum limit of Connect buttons clicked 3 | const LIMIT = 500; 4 | // wait in ms before each scroll 5 | const SCROLL_TIMEOUT = 600; 6 | // bulk scroll will scroll this amount of times 7 | const BULK_SCROLL_COUNT = 15; 8 | // wait in ms before each click 9 | const CLICK_DELAY = 300; 10 | // if this amount of connections in the page, time to click 11 | const MINIMUM_CONNECTS_TO_CLICK = 60; 12 | // if this amount of connections in the page, time to scroll 13 | const MINIMUM_CONNECTS_TO_SCROLL = 10; 14 | 15 | var connects = 0; 16 | var fails = 0; 17 | 18 | 19 | 20 | 21 | // 28 | // retrieves array "Connect" buttons 29 | 30 | //Start here 31 | //const LIMIT = 500; 32 | // wait in ms before each scroll 33 | //const SCROLL_TIMEOUT = 600; 34 | // bulk scroll will scroll this amount of times 35 | //const BULK_SCROLL_COUNT = 15; 36 | // wait in ms before each click 37 | //const CLICK_DELAY = 300; 38 | // if this amount of connections in the page, time to click 39 | //const MINIMUM_CONNECTS_TO_CLICK = 60; 40 | // if this amount of connections in the page, time to scroll 41 | //const MINIMUM_CONNECTS_TO_SCROLL = 10; 42 | 43 | var connects = 0; 44 | var fails = 0; 45 | 46 | function selectButtonElements() { 47 | const buttons = document.getElementsByClassName("pv-skill-entity__featured-endorse-button-shared artdeco-button artdeco-button--circle artdeco-button--muted artdeco-button--1 artdeco-button--secondary ember-view") 48 | console.log(buttons) 49 | return buttons 50 | } 51 | selectButtonElements() 52 | 53 | 54 | 55 | // scrolls to the bottom of the page 56 | // async function singleScroll() { 57 | // return new Promise(resolve => { 58 | // setTimeout(() => { 59 | // window.scrollTo(0, document.body.scrollHeight); 60 | // console.log("scroll!"); 61 | // resolve(); 62 | // }, SCROLL_TIMEOUT); 63 | // }); 64 | // } 65 | 66 | // delays an html element click 67 | async function singleClick(elem) { 68 | return new Promise(resolve => { 69 | setTimeout(() => { 70 | elem.click(); 71 | resolve(); 72 | }, 500); 73 | }); 74 | } 75 | 76 | // // scroll to the bottom of the page several times 77 | // async function bulkScroll() { 78 | // for (let i = 0; i < BULK_SCROLL_COUNT; i++) { 79 | // await singleScroll(); 80 | // } 81 | // } 82 | 83 | // click on all but a few Connect buttons 84 | async function bulkClick() { 85 | let elements = selectButtonElements(); 86 | console.log("elements length:", elements.length); 87 | for (let i = 0; i < elements.length; i++) { 88 | try { 89 | await singleClick(elements[i]); 90 | console.log("click!"); 91 | connects++; 92 | } catch (err) { 93 | fails++; 94 | } 95 | } 96 | console.log('Number of successes!', connects, 'Number of errors', fails); 97 | } 98 | bulkClick() 99 | //End here 100 | // // the list of people to connect to must keep a minimum amount of people 101 | // function isManyConnects(amount) { 102 | // return selectButtonElements().length >= amount; 103 | // } 104 | 105 | // do { 106 | // if (isManyConnects(MINIMUM_CONNECTS_TO_CLICK)) { 107 | // console.log("There are plenty of connections, time to click..."); 108 | // await bulkClick();} 109 | // // else { 110 | // // console.log("Out of connections, need to scroll..."); 111 | // // await bulkScroll(); 112 | // // } 113 | // console.log(`New Connections:${connects} Failed clicks:${fails}`); 114 | // } while (connects < LIMIT); 115 | } 116 | 117 | moreConnectionsPlease(); --------------------------------------------------------------------------------