npm.io
1.1.0 • Published 2 years ago

detect-social-network

Licence
MIT
Version
1.1.0
Deps
0
Size
44 kB
Vulns
0
Weekly
0

detect-social-network

npm version license

detect-social-network is a JavaScript library that allows you to identify the social network from a given URL.

Installation

You can install the library using npm:

npm install detect-social-network

Usage

// Using ES6 Import
import detectSocialNetwork from 'detect-social-network';

const url = "https://twitter.com/jack/status/20";
const socialNetwork = detectSocialNetwork(url);

console.log(`The link belongs to: ${socialNetwork}`);
// Using CommonJS
const detectSocialNetwork = require('detect-social-network');

const url = "https://twitter.com/jack/status/20";
const socialNetwork = detectSocialNetwork.default(url);

console.log(`The link belongs to: ${socialNetwork}`);

Supported Social Networks

Currently, detect-social-network can identify the following social networks:

discord
facebook
github
instagram
linkedin
pinterest
reddit
tiktok
tumblr
twitter
youtube

Keywords