Spaces:
Build error
Build error
feat: block media resources to improve speed
Browse files
backend/functions/package-lock.json
CHANGED
|
@@ -28,6 +28,7 @@
|
|
| 28 |
"openai": "^4.20.0",
|
| 29 |
"puppeteer": "^22.6.3",
|
| 30 |
"puppeteer-extra": "^3.3.6",
|
|
|
|
| 31 |
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
| 32 |
"stripe": "^11.11.0",
|
| 33 |
"tiktoken": "^1.0.10",
|
|
@@ -9912,6 +9913,26 @@
|
|
| 9912 |
}
|
| 9913 |
}
|
| 9914 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9915 |
"node_modules/puppeteer-extra-plugin-stealth": {
|
| 9916 |
"version": "2.11.2",
|
| 9917 |
"resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-stealth/-/puppeteer-extra-plugin-stealth-2.11.2.tgz",
|
|
|
|
| 28 |
"openai": "^4.20.0",
|
| 29 |
"puppeteer": "^22.6.3",
|
| 30 |
"puppeteer-extra": "^3.3.6",
|
| 31 |
+
"puppeteer-extra-plugin-block-resources": "^2.4.3",
|
| 32 |
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
| 33 |
"stripe": "^11.11.0",
|
| 34 |
"tiktoken": "^1.0.10",
|
|
|
|
| 9913 |
}
|
| 9914 |
}
|
| 9915 |
},
|
| 9916 |
+
"node_modules/puppeteer-extra-plugin-block-resources": {
|
| 9917 |
+
"version": "2.4.3",
|
| 9918 |
+
"resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-block-resources/-/puppeteer-extra-plugin-block-resources-2.4.3.tgz",
|
| 9919 |
+
"integrity": "sha512-WLxkytm3Nn6D+3N8lFMIi9lL9lLA1mTRHZAflR+zDs9/d1oOYVy52pWPaiQaetOObgfHDpPlHBmzHE2Yhr3ZnQ==",
|
| 9920 |
+
"dependencies": {
|
| 9921 |
+
"debug": "^4.1.1",
|
| 9922 |
+
"puppeteer-extra-plugin": "^3.2.3"
|
| 9923 |
+
},
|
| 9924 |
+
"engines": {
|
| 9925 |
+
"node": ">=8"
|
| 9926 |
+
},
|
| 9927 |
+
"peerDependencies": {
|
| 9928 |
+
"puppeteer-extra": "*"
|
| 9929 |
+
},
|
| 9930 |
+
"peerDependenciesMeta": {
|
| 9931 |
+
"puppeteer-extra": {
|
| 9932 |
+
"optional": true
|
| 9933 |
+
}
|
| 9934 |
+
}
|
| 9935 |
+
},
|
| 9936 |
"node_modules/puppeteer-extra-plugin-stealth": {
|
| 9937 |
"version": "2.11.2",
|
| 9938 |
"resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-stealth/-/puppeteer-extra-plugin-stealth-2.11.2.tgz",
|
backend/functions/package.json
CHANGED
|
@@ -48,6 +48,7 @@
|
|
| 48 |
"openai": "^4.20.0",
|
| 49 |
"puppeteer": "^22.6.3",
|
| 50 |
"puppeteer-extra": "^3.3.6",
|
|
|
|
| 51 |
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
| 52 |
"stripe": "^11.11.0",
|
| 53 |
"tiktoken": "^1.0.10",
|
|
|
|
| 48 |
"openai": "^4.20.0",
|
| 49 |
"puppeteer": "^22.6.3",
|
| 50 |
"puppeteer-extra": "^3.3.6",
|
| 51 |
+
"puppeteer-extra-plugin-block-resources": "^2.4.3",
|
| 52 |
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
| 53 |
"stripe": "^11.11.0",
|
| 54 |
"tiktoken": "^1.0.10",
|
backend/functions/src/services/puppeteer.ts
CHANGED
|
@@ -51,6 +51,10 @@ puppeteer.use(puppeteerStealth());
|
|
| 51 |
// userAgent: `Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.0; +https://openai.com/gptbot)`,
|
| 52 |
// platform: `Linux`,
|
| 53 |
// }))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
@singleton()
|
| 56 |
export class PuppeteerControl extends AsyncService {
|
|
|
|
| 51 |
// userAgent: `Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.0; +https://openai.com/gptbot)`,
|
| 52 |
// platform: `Linux`,
|
| 53 |
// }))
|
| 54 |
+
const puppeteerBlockResources = require('puppeteer-extra-plugin-block-resources');
|
| 55 |
+
puppeteer.use(puppeteerBlockResources({
|
| 56 |
+
blockedTypes: new Set(['media']),
|
| 57 |
+
}));
|
| 58 |
|
| 59 |
@singleton()
|
| 60 |
export class PuppeteerControl extends AsyncService {
|