Skip to content

Instantly share code, notes, and snippets.

@pereayats
pereayats / search_users.js
Created September 25, 2022 14:35
Find your potential clients on Twitter using some keywords
const OAuth = require('oauth')
const async = require('async')
const _ = require('lodash')
// YOU CAN FIND THIS ON YOUR TWITTER DEVELOPER CONSOLE
const CLIENT_ID = 'YOUR TWITTER CONSUMER KEY'
const CLIENT_SECRET = 'YOUR TWITTER CONSUMER SECRET'
const ACCESS_TOKEN = 'YOUR ACCESS TOKEN'
const ACCESS_SECRET = 'YOUR ACCESS SECRET'
const axios = require('axios')
const cheerio = require('cheerio')
const fs = require('fs')
function waitUntil(t) {
return new Promise(r => {
setTimeout(r, t)
})
}
const puppeteer = require('puppeteer')
const scrape = (async () => {
const browser = await puppeteer.launch({ headless: false })
const page = await browser.newPage()
await page.goto('https://producthunt.com')
const product_links = await page.evaluate(() => {
const links = Array.from(document.querySelectorAll('a[data-test*="post-name-"]'))