Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed Jul 28, 2022
0 parents commit dfe9a53
Show file tree
Hide file tree
Showing 20 changed files with 4,637 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# don't lint node_modules
node_modules

# don't lint build output
lib

# ignore docs
docs

# ignore config files
.eslintrc.js
jest.config.js
# tsup.config.ts

scripts/
example/
13 changes: 13 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
root: true
parser: "@typescript-eslint/parser"
plugins:
- "@typescript-eslint"
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
- prettier
rules:
"@typescript-eslint/explicit-module-boundary-types":
- error
- allowArgumentsExplicitlyTypedAsAny: true
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
131 changes: 131 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

**/.DS_Store
lib/
model/
11 changes: 11 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
printWidth: 100
tabWidth: 4
useTabs: false
trailingComma: all
semi: true
singleQuote: false
overrides:
- files: "*.md"
options:
tabWidth: 2
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 JacobLinCool

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# reCAPTCHA Resolver

Resolve reCAPTCHA challenges by using `vosk` speech recognition library.

Requirements:

- `ffmpeg` installed

```sh
npm i recaptcha-resolver
```

## Example

Checkout [`example/index.mjs`](example/index.mjs)!

```js
import { chromium } from "playwright-core";
import { resolve } from "recaptcha-resolver";

const EXAMPLE_PAGE = "https://www.google.com/recaptcha/api2/demo";

main();

async function main() {
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage();
await page.goto(EXAMPLE_PAGE);

console.time("resolve reCAPTCHA");
await resolve(page);
console.log("solved!");
console.timeEnd("resolve reCAPTCHA");

await page.click("#recaptcha-demo-submit");

page.on("close", async () => {
await browser.close();
process.exit(0);
});
}
```

```sh
❯ node example/index.mjs
solved!
resolve reCAPTCHA: 4.285s
```

### Demo

[demo.mp4 (23s)](example/demo.mp4)

![demo](example/demo.mp4)
Binary file added example/demo.mp4
Binary file not shown.
24 changes: 24 additions & 0 deletions example/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { chromium } from "playwright-core";
import { resolve } from "recaptcha-resolver";

const EXAMPLE_PAGE = "https://www.google.com/recaptcha/api2/demo";

main();

async function main() {
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage();
await page.goto(EXAMPLE_PAGE);

console.time("resolve reCAPTCHA");
await resolve(page);
console.log("solved!");
console.timeEnd("resolve reCAPTCHA");

await page.click("#recaptcha-demo-submit");

page.on("close", async () => {
await browser.close();
process.exit(0);
});
}
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
};
47 changes: 47 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "recaptcha-resolver",
"version": "0.1.0",
"description": "Resolve reCAPTCHA challenges by using speech recognition.",
"main": "lib/index.js",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
"scripts": {
"test": "jest --coverage",
"dev": "tsup --watch",
"build": "tsup",
"docs": "typedoc ./src/",
"format": "prettier --write '**/*.{js,ts,jsx,tsx,json,yml,yaml,md,html}' --ignore-path .gitignore",
"lint": "eslint .",
"postinstall": "node ./scripts/postinstall.js"
},
"keywords": ["reCAPTCHA"],
"author": "JacobLinCool <[email protected]> (https://github.com/JacobLinCool)",
"license": "MIT",
"files": [
"scripts",
"lib"
],
"devDependencies": {
"@types/jest": "^27.4.0",
"@types/node": "^17.0.10",
"@types/wav": "^1.0.1",
"@types/yauzl": "^2.10.0",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.3.0",
"jest": "^27.4.7",
"prettier": "^2.5.1",
"recaptcha-resolver": "workspace:*",
"ts-jest": "^27.1.3",
"tsup": "^5.11.11",
"typedoc": "^0.22.11",
"typescript": "^4.5.5"
},
"dependencies": {
"playwright-core": "^1.24.1",
"vosk": "^0.3.39",
"wav": "^1.0.2",
"yauzl": "^2.10.0"
}
}
Loading

0 comments on commit dfe9a53

Please sign in to comment.