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 { chromium, Page } from "playwright-core" | |
/** | |
* Entrypoint. | |
* | |
* @remarks | |
* Demonstrates a safe typing algorithm that mimics human typing cadence. | |
* | |
* @public | |
*/ |
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
/** | |
* This is a test to show how to compose objects with typescript. | |
*/ | |
/** | |
* Creates an intersection type from a union type. | |
* @public | |
*/ | |
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ( | |
k: infer I |
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
/** Types **/ | |
type JobId = string | |
type JobHandler<T> = () => Promise<T> | |
interface Job<T = any> { | |
id: JobId | |
handle: JobHandler<T> | |
locked: boolean | |
result?: any | |
} |
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
export function containsString(src: string | null | undefined, toFind: string): boolean { | |
return src != null && src.indexOf(toFind) >= 0 | |
} | |
export function normalizePath(eslintPackagePath: string | undefined): string | undefined { | |
if (eslintPackagePath === undefined) return undefined | |
if (eslintPackagePath.charAt(eslintPackagePath.length - 1) !== '/' && | |
eslintPackagePath.charAt(eslintPackagePath.length - 1) !== '\\') { | |
eslintPackagePath = eslintPackagePath + '/'; | |
} |
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 { randomInt } from "node:crypto" | |
import type Puppeteer from "puppeteer-core" | |
/** Recast Puppeteer private properties **/ | |
type Page = Omit<Puppeteer.Page, "_client"> & { | |
readonly _client: Puppeteer.CDPSession | |
} | |
type ElementHandle = Omit<Puppeteer.ElementHandle, "_page"> & { |
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 { Buffer } from "buffer" | |
import { createHash } from "crypto" | |
import { HTTPRequest, Protocol } from "puppeteer-core" | |
import { isPuppeteerPage, Page } from "../types" | |
type CaptureSnapshotResponse = Protocol.DOMSnapshot.CaptureSnapshotResponse | |
type RequestHook = (request: HTTPRequest) => Promise<void> |
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 { createWriteStream, ensureDir } from "fs-extra" | |
import got from "got" | |
import { Stream } from "stream" | |
export type Platform = | |
| "Win_x64" | |
| "Win" | |
| "Mac" | |
| "Mac_Arm" | |
| "Linux_x64" |
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-extra" | |
import recaptcha from "puppeteer-extra-plugin-recaptcha" | |
/** | |
* Install the Recaptcha Plugin | |
*/ | |
puppeteer.use( | |
recaptcha({ | |
provider: { | |
id: "2captcha", |
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 { IncomingMessage, RequestListener, ServerResponse } from "http" | |
import { createServer, Server } from "https" | |
import puppeteer, { | |
Browser, | |
BrowserLaunchArgumentOptions, | |
Protocol | |
} from "puppeteer-core" | |
import { Page } from "./types" | |
import Cookie = Protocol.Network.Cookie |
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
/** namespace App\Actors **/ | |
const Actor = require('./Actor'); | |
class BotcheckActor extends Actor { | |
platform = 'botcheck'; | |
constructor(env) { | |
const config = require('../../config/actors/botcheck'); |
NewerOlder