Socket
Socket
Sign inDemoInstall

social-network-detector

Package Overview
Dependencies
17
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    social-network-detector

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


Version published
Weekly downloads
112
decreased by-17.65%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

  • http://m.facebook.com/
  • android-app://com.facebook.lite/
  • https://lm.facebook.com/

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

Keywords

FAQs

Last updated on 23 Sep 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc