
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
meddelare-counters
Advanced tools
Node.js promise-based, asynchronous, parallel, per-URL social network share count fetcher -- the base of Meddelare.
⚠️ The Meddelare Social Buttons project has been shut down as of 2020-12-07. No updates will be made and the source code will possibly be deleted in the future. Please download what you need as soon as possible.
Install custom social share counters on your website with your own hosted solution, which only makes a single API request and loads minimal or zero assets to display the counters.
Check out meddelare.com and view examples on meddelare.com/meddelare-examples.
Node.js promise-based, asynchronous, parallel, per-URL social network share count fetcher -- the base of Meddelare.
Install package in your project folder
npm install --save meddelare-counters
Fetch counts from social networks
var MeddelareCounters = require("meddelare-counters"),
meddelareCounters = new MeddelareCounters();
// Use your own website here, or a specific page url.
var url = "https://meddelare.com/",
networks = [
"facebook",
"twitter",
"googleplus",
];
meddelareCounters.retrieveCounts(url, networks)
.then(function(results) {
console.log("Success!", results);
})
.catch(function(err) {
console.error("Fail!", err);
});
Url
Use the url
parameter to specify the address which you want to retrieve the number of shares for.
https://
or http://
in the URL.&
by avoiding double-encoding the address.Networks
Currently Twitter, Facebook and Google Plus are supported.
Use the networks
parameter to specify which ones you want to use, as an array of strings, for example ["facebook", "twitter", "googleplus"]
or ["facebook"]
.
Returns
The function returns a Promise. It resolves using .then(function(result){ ... })
for most cases, only rejecting using .catch(function(err){ ... })
when something exceptional happens -- but please expect and implement both.
If a request to a social network failed, a count of -1
is returned for that network.
{
"facebook": 5281,
"googleplus": 42,
"twitter": 8719
}
Configure the middleware instance at creation time, for example new MeddelareCounters({ unknownCount: 0 })
.
These are the default values.
{
// A reference to an object that implements `log`, `info`, `warn`, `error`.
logger: console,
// Cache results in memory -- but keep good and bad (error thrown) results for different periods of time.
// (In milliseconds.)
memoryCache: {
goodResultTimeout: 4 * 60 * 1000,
badResultTimeout: 1 * 60 * 1000,
timeoutResultTimeout: 10 * 1000,
},
// Return this value if none was found or an error was thrown.
unknownCount: -1,
}
Many thanks goes out to Taskforce for their social-buttons-server (released into the Public Domain) -- especially the creator @thomasdavis and contributor @beaugunderson. This software, meddelare-node-counters, is based on their work.
Copyright (c) 2015 Team Meddelare https://meddelare.com/ All rights reserved.
When using meddelare-node-counters, comply to the MIT license.
FAQs
Node.js promise-based, asynchronous, parallel, per-URL social network share count fetcher -- the base of Meddelare.
The npm package meddelare-counters receives a total of 27 weekly downloads. As such, meddelare-counters popularity was classified as not popular.
We found that meddelare-counters demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.