Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/t2bamboo/t2-puppeteer-plugin-block-resources
Blocks unnecessary resources like images, fonts, and stylesheets to optimize performance and speed up page loads.
https://github.com/t2bamboo/t2-puppeteer-plugin-block-resources
automation performance puppeteer puppeteer-extra resource-optimization web-scraping
Last synced: 3 days ago
JSON representation
Blocks unnecessary resources like images, fonts, and stylesheets to optimize performance and speed up page loads.
- Host: GitHub
- URL: https://github.com/t2bamboo/t2-puppeteer-plugin-block-resources
- Owner: T2Bamboo
- Created: 2025-01-09T18:13:02.000Z (14 days ago)
- Default Branch: main
- Last Pushed: 2025-01-18T15:42:49.000Z (5 days ago)
- Last Synced: 2025-01-20T11:17:01.357Z (4 days ago)
- Topics: automation, performance, puppeteer, puppeteer-extra, resource-optimization, web-scraping
- Language: TypeScript
- Homepage:
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# t2-puppeteer-plugin-block-resources
[![npm version](https://badge.fury.io/js/t2-puppeteer-plugin-block-resources.svg)](https://badge.fury.io/js/t2-puppeteer-plugin-block-resources)
## Description
## Installation
```bash
npm install t2-puppeteer-plugin-block-resources
```or using Yarn:
```bash
yarn add t2-puppeteer-plugin-block-resources
```### Usage with puppeteer-extra
```js
import puppeteerExtra from 'puppeteer-extra';
import blockResources from 't2-puppeteer-plugin-block-resources';// | "document"
// | "stylesheet"
// | "image"
// | "media"
// | "font"
// | "script"
// | "texttrack"
// | "xhr"
// | "fetch"
// | "eventsource"
// | "websocket"
// | "manifest"
// | "other"const bl=blockResources()
bl.add(['image','media','stylesheet'])
puppeteerExtra.use(bl);(async () => {
const browser = await puppeteerExtra.launch({
headless:false,
});
const page = await browser.newPage();await page.setViewport({
width: 1920,
height: 1080
});await page.goto('https://unsplash.com/')
// await browser.close();
})();```