This file contains 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
import Xvfb from "xvfb"; | |
const runHeadless = async () => { | |
const xvfb = new Xvfb(); | |
xvfb.startSync(); | |
// run the code that needs a | |
// virtual display | |
xvfb.stopSync(); |
This file contains 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
import config from "../keys"; | |
import { TwitterApi } from "twitter-api-v2"; | |
const addReplyToTweet = async (tweetID, assetURL) => { | |
const twitterClient = new TwitterApi({ | |
appKey: config.TWITTER_CONSUMER_KEY, | |
appSecret: config.TWITTER_CONSUMER_SECRET, | |
accessToken: config.TWITTER_ACCESS_TOKEN, | |
accessSecret: config.TWITTER_ACCESS_TOKEN_SECRET, | |
}); |
This file contains 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
const mintNFT = async (browser, page) => { | |
const createButton = await page.$x('//button[contains(., "Create")]'); | |
await createButton[0].click(); | |
await page.waitForSelector( | |
"div.AssetSuccessModalContentreact__DivContainer-sc-1vt1rp8-1" | |
); | |
await page.waitForTimeout(10000); | |
const assetURL = page.url(); |
This file contains 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
const fillLevels = async (page, tries) => { | |
const levelsButton = await page.$x( | |
'//*[@id="main"]/div/div/section/div[2]/form/section/div[2]/div/div[2]/button' | |
); | |
await levelsButton[0].click(); | |
await page.waitForSelector('input[placeholder="Speed"]'); | |
await page.focus('input[placeholder="Speed"]'); | |
await page.keyboard.type("Tries", { delay: 25 }); |
This file contains 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
const addDescription = async (page, description) => { | |
await page.focus("#description"); | |
await page.keyboard.type(description, { delay: 25 }); | |
}; |
This file contains 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
const addExternalLink = async (page, link) => { | |
await page.focus("#external_link"); | |
await page.keyboard.type(link, { delay: 25 }); | |
}; |
This file contains 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
const addName = async (page, name) => { | |
await page.focus("#name"); | |
await page.keyboard.type(name, { delay: 25 }); | |
}; |
This file contains 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
const createAssetURL = `https://opensea.io/collection/${config.COLLECTION_NAME}/assets/create` | |
const uploadImage = async (page, filepath) => { | |
await page.bringToFront(); | |
await page.goto(createAssetURL); | |
await page.waitForSelector("#media"); | |
const elementHandle = await page.$("#media"); | |
await elementHandle.uploadFile(filepath); | |
}; |
This file contains 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
import puppeteer from "puppeteer"; | |
import * as dappeteer from "@chainsafe/dappeteer"; | |
import config from "../keys"; | |
const createAssetURL = `https://opensea.io/collection/${config.COLLECTION_NAME}/assets/create` | |
const setUp = async () => { | |
const browser = await dappeteer.launch(puppeteer, { | |
metamaskVersion: config.METAMASK_VERSION, | |
args: ["--no-sandbox", "--disable-setuid-sandbox"], |
This file contains 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
import axios from "axios"; | |
import config from "../keys"; | |
export default class TweetPikService { | |
async getScreenshot(tweetId) { | |
const response = await axios.post( | |
`https://tweetpik.com/api/images`, | |
{ | |
tweetId, | |
themeId: config.TWEETPIK_THEME_ID, |
NewerOlder