Skip to content

Commit d4301fe

Browse files
committed
Revert "roll puppeteer-extra-plugin-stealth back"
This reverts commit 06088b4.
1 parent f1a6304 commit d4301fe

File tree

4 files changed

+332
-10
lines changed

4 files changed

+332
-10
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
cd work-fonts
6464
git clone --depth=1 https://github.com/dev-protocol/stackroom.git
6565
cd stackroom/fonts
66-
mv IBM_Plex_Sans_JP/* ./
66+
mv IBM_Plex_Sans_JP/IBMPlexSansJP-Bold.ttf ./
6767
rm -rf IBM_Plex_Sans_JP
6868
mv Noto_Color_Emoji/* ./
6969
rm -rf Noto_Color_Emoji

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"license": "MPL-2.0",
1616
"dependencies": {
1717
"@sparticuz/chromium": "^132.0.0",
18-
"puppeteer-core": "^24.2.0"
18+
"puppeteer-core": "^24.2.0",
19+
"puppeteer-extra": "^3.3.6",
20+
"puppeteer-extra-plugin-stealth": "^2.11.2"
1921
},
2022
"devDependencies": {
2123
"@eslint/js": "^9.12.0",

src/libs/chromium.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
import type { Browser, LaunchOptions } from 'puppeteer-core'
2-
import puppeteer from 'puppeteer-core'
1+
import type { Browser, PuppeteerLaunchOptions } from 'puppeteer-core'
2+
import puppeteer from 'puppeteer-extra'
3+
import StealthPlugin from 'puppeteer-extra-plugin-stealth'
4+
5+
// eslint-disable-next-line functional/no-expression-statements
6+
puppeteer.use(StealthPlugin())
37

48
export const Chromium = (() => {
5-
const instances: WeakMap<LaunchOptions, Browser> = new WeakMap()
9+
const instances: WeakMap<PuppeteerLaunchOptions, Browser> = new WeakMap()
610

7-
const createInstance = (options: LaunchOptions) => {
11+
const createInstance = (options: PuppeteerLaunchOptions) => {
812
// eslint-disable-next-line functional/no-expression-statements
913
console.log('&&&&&', 'new chromium instanse will be created')
1014
return puppeteer.launch(options)
1115
}
1216

1317
return {
14-
getInstance: async (options: LaunchOptions) => {
18+
getInstance: async (options: PuppeteerLaunchOptions) => {
1519
const fromCache = instances.get(options)
1620
const instance = fromCache
1721
? fromCache

0 commit comments

Comments
 (0)