
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
pixelcanvas-scraper
Advanced tools
This package allows it to scrape a specific area of pixelcanvas' canvas in an easy way without complex parsing.
Have Fun :)
Just execute npm install pixelcanvas-scraper
and require it like this:
const Scraper = require('pixelcanvas-scraper');
Start right away with this example:
const Scraper = require("pixelcanvas-scraper");
const scraper = new Scraper("your-fingerprint", { x: -513, y: 2780, w: 32, h: 32 });
var canvas;
scraper.get().then(canvasMatrix => { // initially get the whole area
canvas = canvasMatrix;
});
scraper.connectEventSource(); // connect to pixelcanvas
scraper.on("update", data => {
console.log("Pixel updated: ", data);
canvas.update(data.x, data.y, data.color);
});
// The newest data is available in the getColor method
setTimeout(() => {
console.log(scraper.getColor(-513, 2780));
}, 2000);
For a whole api server look into the index.js and index.html file.
new Scraper(fingerprint, area)
Creates a new Scraper object.
Parameters:
fingerprint
: Your pixelcanvas.io fingerprint. How to aquire a fingerprintarea
: The area to scrape. Containing the top left corner (x, y) and the width and the height of the area (w, h).Example:
const area = {
x: -513,
y: 2780,
w: 32,
h: 32
}
const scraper = new Scraper("fingerprint", area);
scraper.get()
This function will scrape the current state of the area along with some pixels around it.
Promise
PixelMatrix
scraper.getColor(x, y)
This function returns the color of the pixel at the given coordinates. This will always contain the newest version of the color data.
Returns: Color
scraper.connectEventSource()
Connect to the pixelcanvas eventSource. If you don't call this function, the scraper will not receive any events and will not update the pixels.
scraper.on(event, callback)
Lets you listen to events. Available events are:
update
: This event is triggered, when a pixel in the area has been changed. It will
be triggered with the following data:
x
: The x position of the pixely
: The y position of the pixelcolor
: The color of the pixelconnectionReady
: This event will fire when the eventSource connects to pixelcanvas. It delivers the event object provided by the EventSource package.connectionError
: This event will fire when the eventSource fails to connect to pixelcanvas. It delivers the event object provided by the EventSource package.An object that contains data about pixels and their color.
Functions:
getColor(x, y)
: Returns the color of the pixel at the given coordinates.Advanced use:
You can access pixels of the matrix manually by accessing the .matrix
property. It's a 2-dimensional array where the first index is the x coordinate of a pixel and the second index is the y coordinate of a pixel.
Example:
matrix.matrix[20][10]; // this will return the pixel at the coordinates x = 20 and y = 10
Also you can update a specific pixel by calling the .update(x, y, color)
function. This won't work if the pixel is not in the area specified on constructing.
An utility class that deals with the colors needed for pixelcanas
Properties/Methods:
EnumColor.ENUM
: An array of all colors that are valid for pixelcanvas.EnumColor.index(i)
: Returns the color that has the same pixelcanvas index like i
.A color object that contains the color information.
Properties:
.name
: The name of the color.index
: The index of the color as it is indexed on pixelcanvas.rgb
: The rgb values of the color.Please look at this.
You can use this for free of course. I'd love to see modifications of this.
Just credit me, ShadowLp174, as the author :)
FAQs
A pixelcanvas.io scraper
The npm package pixelcanvas-scraper receives a total of 2 weekly downloads. As such, pixelcanvas-scraper popularity was classified as not popular.
We found that pixelcanvas-scraper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.