Skip to content

This library allows you to identify a social platform from the provided link.

License

Notifications You must be signed in to change notification settings

danielabyan/social-network-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Social Network Detector

This library allows you to define a social platform by URI.

The library accepts http/https protocol (also mobile application protocols like android-app://). So all these URIs will detected as facebook

Installation

This module is designed to be used using either browserify or Node.js it's released in the public npm registry and can be installed using:

npm install social-network-detector

Usage

Use the getNetworksList method to get a list of all supported platforms

var socialNetworkDetector = require('./src/social-network-detector');

socialNetworkDetector.getNetworksList();

/* 
* Will return a similar array
* [ 
*   'facebook', 'twitter', 'linkedin', 'reddit', 'vkontakte', 'pinterest', 'tumblr', 'telegram', 
*   'snapchat', 'slack', 'youtube', 'whatsapp', 'wechat', 'instagram', 'qq', 'tiktok', 'medium', 
*   'quora', 'weibo', 'twitch', 'discord', 'anchor', 'angellist', 'behance', 'clubhouse', 'devdotto',
*   'dribbble', 'github', 'onlyfans', 'producthunt', 'spotify', 'substack', 'wikipedia', 
* ]
*/

Here are some examples of the library in action

var socialNetworkDetector = require('social-network-detector');

socialNetworkDetector.detect('https://staticxx.facebook.com/platform/'); // facebook
socialNetworkDetector.detect('android-app://com.linkedin.android'); // linkedin
socialNetworkDetector.detect('https://twitter.com/abyandaniel/status/1371762841066348544?s=20'); // twitter
socialNetworkDetector.detect('https://google.com/'); // null, since this is not a social platform
socialNetworkDetector.detect('https://newsstand.joomag.com/en/'); // null, since this is not a social platform
socialNetworkDetector.detect('https://t.co/Jyx44u722z?amp=1'); // twitter

License

MIT

About

This library allows you to identify a social platform from the provided link.

Resources

License

Stars

Watchers

Forks

Packages

No packages published