Skip to content

Instantly share code, notes, and snippets.

@MarketingPip
Created April 25, 2024 21:01
Show Gist options
  • Save MarketingPip/fa195bef28cabdabe44a6a65925a600e to your computer and use it in GitHub Desktop.
Save MarketingPip/fa195bef28cabdabe44a6a65925a600e to your computer and use it in GitHub Desktop.
Code I updated for Fred.
/* Modified and created by Jared Van Valkengoed */
import puppeteer from "puppeteer";
import * as cheerio from "cheerio";
async function tokenShoter() {
const browser = await puppeteer.launch({
headless: false,
defaultViewport: null,
});
const page = await browser.newPage();
const url = "https://www.pinksale.finance/launchpads?chain=ETH";
await page.goto(url, { waitUntil: "networkidle2" });
// Wait for the page to be fully loaded
//await page.waitForLoadState('networkidle2');
// Scroll to the bottom of the page
await page.evaluate(() => {
window.scrollTo(0, document.body.scrollHeight);
});
// Wait for a brief moment after scrolling (adjust the time as needed)
await page.waitForTimeout(1000);
const content = await page.content();
//console.log(content)
const $ = cheerio.load(content);
const contentWrapper = $("div.launchpad-page");
const presaleTitle = contentWrapper.find(".launchpad-title");
const tabHolder = $("div.ant-tabs");
const parentDiv = $("div.ant-tabs-content-holder");
const tokens = $("div.content-title");
tokens.each((index, el) => {
const token = $(el);
const title = token.find("p.title").text();
const subtitle = token.find("p.subtitle").text();
const softHardCap = token.next(".soft-hard-cap").find("span").text();
const progressTitle = token.next(".content-progress").find("p.title").text();
const progressPercentage = token.next(".content-progress").find(".ant-progress-bg").attr("style");
const liquidityPercent = token.next(".liquidity-percent").find("span.time-text").text();
const lockupTime = token.next(".lockup-time").find("span.time-text").text();
const countdown = token.next(".custom-card-footer").find(".countdown-text strong span").toArray().map(span => $(span).text()).join(':');
console.log("Title:", title);
console.log("Subtitle:", subtitle);
console.log("Soft/Hard Cap:", softHardCap);
console.log("Progress:", progressTitle, progressPercentage);
console.log("Liquidity Percent:", liquidityPercent);
console.log("Lockup Time:", lockupTime);
console.log("Countdown:", countdown);
console.log("-------------");
});
await page.close();
await browser.close();
//return indoorSpaces;
}
tokenShoter()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment