Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fse = require('fs-extra');
- const puppeteer = require("puppeteer-extra")
- // add stealth plugin and use defaults (all evasion techniques)
- const pluginStealth = require("puppeteer-extra-plugin-stealth")
- puppeteer.use(pluginStealth())
- const nodemailer = require("nodemailer");
- function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
- function isEmptyObject(obj) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
- return false;
- }
- }
- return true;
- }
- async function getlinks() {
- const browser = await puppeteer.launch({headless: false});
- const page = await browser.newPage();
- await page.goto('https://www.facebook.com/search/101881036520836/places-in/124816677590074/places/intersect/');
- autoScroll(page);
- await sleep(500000);
- var links = await page.$$eval('ul.uiList._4kg._6-i._6-h._6-j ._2oqr a', as => as.map(a => a.href));
- console.log(links)
- var json = JSON.stringify(links);
- fse.outputFile('files/links.json', json)
- }
- // getlinks();
- async function getemail() {
- var links = [];
- const browser = await puppeteer.launch({headless: false});
- const page = await browser.newPage();
- // await page.setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25');
- // await page.setViewport({ width: 414, height: 736});
- var le = [];
- for (var li of links) {
- // console.log('going')
- await page.goto(li+'about');
- var com = {};
- try {
- var emails = await page.$$eval('._4bl9', as => as.map(a => a.innerText));
- for (email of emails) {
- if (email.includes('@')) {
- // console.log(email);
- com['email'] = email;
- break;
- }
- }
- } catch (e) {
- console.log('email not found')
- }
- try {
- var company = await page.$eval('._64-f', e => e.innerText);
- com['company'] = company;
- } catch (e) {
- // console.log('company name')
- }
- le.push(com);
- console.log(le);
- var json = JSON.stringify(le);
- fse.outputFile('files/company2.json', json)
- }
- }
- // getemail();
- async function sendmail() {
- var company = [];
- for (var com of company) {
- // console.log(com['Email']);
- if (!isEmptyObject(com['Email'])) {
- let transporter = nodemailer.createTransport({
- host: "smtp.sendgrid.net",
- port: 465,
- secure: true, // true for 465, false for other ports
- auth: {
- user: 'r3tr0tech', // generated ethereal user
- pass: 'oneplus6T^' // generated ethereal password
- }
- });
- com['First'] = com['First'].substring(0, com['First'].indexOf(' '));
- var subject = '';
- if (com['Company'].includes('/') || com['Company'].includes('Attorney at Law')) {
- subject = com['First']+' about your attorney company';
- } else {
- subject = com['First']+' About '+com['Company'];
- }
- let mailOptions = {
- from: '"R3tr0" <info@r3tr0.tech>', // sender address
- to: com['Email'], // list of receivers
- subject: subject,
- text: 'Hello,\n' +
- '\n' +
- 'Let me first introduce my self, I have been working as a web designer/developer for about 4 years. I have recently launched a start-up company and I am providing modern websites for law firms & attorneys at a very (I MEAN A VERY) low cost, no one\'s gonna do this cheap.\n' +
- '\n' +
- 'Here\'s what you\'re going to get : \n' +
- '\n' +
- 'Full website creation\n' +
- '5-10 pages\n' +
- 'Social networks integration\n' +
- 'Contact page with Google Map\n' +
- 'Responsive design and supports every device\n' +
- 'And more features, just say the word!\n' +
- 'If you want a new modern looking, responsive device friendly for your contractor law company or you want to revolutionize your current site, then I\'m the guy!\n' +
- '\n' +
- 'You can know more about my service from this link https://www.fiverr.com/share/xeWva\n' +
- '\n' +
- '100% money back guaranteed, if you don\'t like my work then you can get your money back, give my service a try, I\'m sure you\'ll love it!\n' +
- '\n' +
- 'P.S: Client\'s satisfaction is my number one priority, I will do my best to satisfy you.\n' +
- '\n' +
- ' \n' +
- '\n' +
- 'If you don\'t want to receive any email from me then please reply \'No\'.\n' +
- '\n' +
- ' \n' +
- '\n' +
- 'Thank you.\n' +
- '\n' +
- 'r3tr0.tech',
- html: `<p>Hello ${com['First']},</p><p>Let me first introduce my self, I have been working as a web designer/developer for about 4 years. I have recently launched a start-up company and I am providing modern websites for law firms & attorneys at a very (I MEAN A VERY) low cost, no one's gonna do this cheap.</p><p>Here's what you're going to get : </p><ul><li>Full website creation</li><li>5-10 pages</li><li>Social networks integration</li><li>Contact page with Google Map</li><li>Responsive design and supports every device</li><li>And more features, just say the word!</li></ul><p>If you want a new modern looking, responsive device friendly for your contractor law company or you want to revolutionize your current site, then I'm the guy!</p><p>You can know more about my service from this link <a href="https://www.fiverr.com/share/xeWva">https://www.fiverr.com/share/xeWva</a></p><p><span style="color: #ff0000;"><strong>100% money back guaranteed, if you don't like my work then you can get your money back, give my service a try, I'm sure you'll love it!</strong></span></p><p>P.S: Client's satisfaction is my number one priority, I will do my best to satisfy you.</p><p> </p><p><strong>If you don't want to receive any email from me then please reply 'No'.</strong></p><p> </p><p>Thank you.</p><p>r3tr0.tech</p>` // html body
- };
- try {
- let info = await transporter.sendMail(mailOptions)
- } catch (e) {
- console.log('fail')
- }
- console.log("Message sent: %s", com['Email']);
- }else {
- console.log('email not found');
- }
- await sleep(1000);
- }
- }
- // sendmail()
- async function mississipibar() {
- var clients = [];
- const browser = await puppeteer.launch({headless: false});
- const page = await browser.newPage();
- await page.goto('https://www.msbar.org/lawyer-directory.aspx?type=7&term=B', {timeout : 400000});
- var list = await page.$$('section.LawyerInformation.cf');
- for (var li of list) {
- var name = await li.$$('.DataHolder')
- var i = 0;
- var client = {};
- for (var n of name) {
- var text = await (await n.getProperty('textContent')).jsonValue();
- text = text.trim();
- // console.log(text);
- if (i == 0) {
- client['First'] = text
- i++;
- } else if (i == 1) {
- client['Company'] = text;
- i++;
- } else if (text.includes('@')) {
- client['Email'] = text;
- i++;
- }
- clients.push(client);
- }
- }
- clients = [...new Set(clients)]
- }
- // mississipibar();
- async function fiverr() {
- const browser = await puppeteer.launch({headless: false, defaultViewport: null, slowMo:10});
- const page = await browser.newPage();
- await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36');
- await page.goto('https://www.fiverr.com');
- var i = 0;
- var n = 1;
- //var links = ['https://www.fiverr.com/users/pythonphpjs/seller_dashboard','https://www.fiverr.com/users/pythonphpjs/manage_orders?source=header_navigation','https://www.fiverr.com/users/pythonphpjs/manage_gigs','https://www.fiverr.com/users/pythonphpjs/seller_analytics_dashboard','https://www.fiverr.com/users/pythonphpjs/balance/sales','https://www.fiverr.com/users/pythonphpjs/balance/sales','https://www.fiverr.com/users/pythonphpjs/requests',]
- var links = ['//*[@id="Header-component"]/header/div/div/nav[1]/ul/li[3]/a','//*[@id="Header-component"]/header/div/div/nav[1]/ul/li[4]/a','//*[@id="Header-component"]/header/div/div/nav[1]/ul/li[5]/a','//*[@id="Header-component"]/header/div/div/nav[1]/ul/li[6]/a']
- var time = [1,2,3,4,5];
- while (i < n) {
- var text = "";
- var possible = "56789";
- text = time[Math.floor(Math.random()*time.length)];
- var item = links[Math.floor(Math.random()*links.length)];
- text = parseInt(text);
- console.log('waiting for '+text+' going to '+item);
- try {
- var logo = await page.$x('//*[@id="Header-component"]/header/div/div/a');
- await logo[0].click();
- console.log('Click');
- } catch (e) {
- page.reload();
- }
- await sleep(text*60000);
- try {
- const linkHandlers = await page.$x(item);
- await linkHandlers[0].click();
- console.log('Click');
- } catch(e) {
- page.reload();
- }
- }
- console.log('waited');
- }
- fiverr();
- async function linkedin() {
- const browser = await puppeteer.launch({headless: false});
- const page = await browser.newPage();
- await sleep(30000);
- await page.goto('https://www.linkedin.com/search/results/people/?facetGeoRegion=%5B%22us%3A0%22%5D&facetIndustry=%5B%224%22%5D&facetNetwork=%5B%22F%22%2C%22S%22%2C%22O%22%5D&keywords=ceo%20web%20developer%20software&origin=GLOBAL_SEARCH_HEADER&page=3');
- autoScroll(page);
- var u = 0;
- var n = 1;
- var leads = [];
- while(u < n){
- var j = 0;
- await sleep(10000);
- var links = await page.$$('.search-result__info');
- for (var li of links) {
- var link = {};
- try {
- link['link'] = await li.$eval('a', e => e.getAttribute('href'));
- // console.log(link);
- } catch (e) {
- link['link'] = null;
- }
- try {
- link['name'] = await li.$eval('span.name.actor-name', e => e.innerText);
- } catch (e) {
- link['name'] = null;
- }
- leads.push(link);
- j++;
- if (j >= 10) {
- break;
- }
- }
- console.log('here');
- try {
- await page.click('.artdeco-pagination__button.artdeco-pagination__button--next');
- console.log('clcik')
- } catch (e) {
- }
- leads = [...new Set(leads)];
- console.log(leads.length);
- var json = JSON.stringify(leads);
- fse.outputFile('files/clients.json', json)
- }
- }
- async function google() {
- const browser = await puppeteer.launch({headless: false});
- const page = await browser.newPage();
- // await sleep(30000);
- await page.goto('http://google.com')
- // autoScroll(page);/
- await page.goto('https://www.google.com/search?q=site%3Alinkedin.com+intitle%3Aceo+%22web%20development%22++%22new%20york%22++%22Honors+%26+Awards%22&oq=site%3Alinkedin.com&start=0');
- await sleep(30000);
- var u = 1;
- var n = 30;
- var leads = [];
- while(u < n){
- var j = 0;
- // await sleep(10000);
- await page.goto('https://www.google.com/search?q=site%3Alinkedin.com+intitle%3Aceo+%22web%20development%22++%22new%20york%22++%22Honors+%26+Awards%22&oq=site%3Alinkedin.com&start='+u*10);
- console.log('SRG G')
- var links = [];
- links = await page.$$('.srg .g');
- for (var li of links) {
- console.log('here');
- var link = {};
- try {
- link['link'] = await li.$eval('a', e => e.getAttribute('href'));
- // console.log(link);
- } catch (e) {
- link['link'] = null;
- }
- try {
- link['name'] = await li.$eval('h3', e => e.innerText);
- } catch (e) {
- link['name'] = null;
- }
- console.log(link);
- leads.push(link);
- }
- // leads = [...new Set(leads)];
- console.log(leads);
- await sleep(20000);
- try {
- await page.click('#pnnext');
- } catch (e) {
- await sleep(30000)
- }
- u++;
- var json = JSON.stringify(leads);
- fse.outputFile('files/google.json', json)
- }
- }
- // google()
- // linkedin()
- async function autoScroll(page){
- await page.evaluate(async () => {
- await new Promise((resolve, reject) => {
- console.log('scrolling...');
- var totalHeight = 0;
- var distance = 500;
- var timer = setInterval(() => {
- console.log('testing here')
- var elmnt = document.getElementsByClassName("pbNvD");
- console.log(elmnt,' element')
- var scrollHeight = elmnt.scrollHeight;
- console.log(scrollHeight);
- window.scrollBy(0, distance);
- totalHeight += distance;
- if(totalHeight >= scrollHeight){
- clearInterval(timer);
- resolve();
- }
- }, 1000);
- });
- });
- }
- async function blockImages(page) {
- page.on('request', interceptedRequest => {
- if (interceptedRequest.url().endsWith('.png') || interceptedRequest.url().endsWith('.jpg')){
- interceptedRequest.abort();
- } else{
- interceptedRequest.continue();
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement