Skip to content

Commit

Permalink
feat: block media resources to improve speed
Browse files Browse the repository at this point in the history
  • Loading branch information
nomagick committed Apr 18, 2024
1 parent cbc13ec commit abc817e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
21 changes: 21 additions & 0 deletions backend/functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"openai": "^4.20.0",
"puppeteer": "^22.6.3",
"puppeteer-extra": "^3.3.6",
"puppeteer-extra-plugin-block-resources": "^2.4.3",
"puppeteer-extra-plugin-stealth": "^2.11.2",
"stripe": "^11.11.0",
"tiktoken": "^1.0.10",
Expand Down
4 changes: 4 additions & 0 deletions backend/functions/src/services/puppeteer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ puppeteer.use(puppeteerStealth());
// userAgent: `Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.0; +https://openai.com/gptbot)`,
// platform: `Linux`,
// }))
const puppeteerBlockResources = require('puppeteer-extra-plugin-block-resources');
puppeteer.use(puppeteerBlockResources({
blockedTypes: new Set(['media']),
}));

@singleton()
export class PuppeteerControl extends AsyncService {
Expand Down

0 comments on commit abc817e

Please sign in to comment.