npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

socialz

v1.0.1

Published

A package which provides you with the analytics of major social media platforms.

Downloads

1

Readme

socialz

A package which provides you with the analytics of major social media platforms.

Supported social media platforms

  • Facebook
  • Instagram
  • Tiktok
  • Linkedin
  • Twitter
  • Youtube

Installation Guide

Install the package in your js/ts appication.

npm install socialz
OR
yarn add socialz

Integration Guide

Facebook

Create facebook developer account. (https://developers.facebook.com/)

Create facebook app. (https://developers.facebook.com/apps/?show_reminder=true)

Configure facebook login for your facebook app. (https://developers.facebook.com/apps/{your-app-id}/fb-login/settings/)

Add your application's server URL in Valid OAuth Redirect URIs input.

Import Facebook constructor from the sdk. Create Facebook instance.

import { Facebook } from 'socialX';

const facebook = new Facebook({
  apiKey: '',
  apiSecret: '',
  redirectLink: '',
});

You'll find apiKey as App ID and apiSecret as App Secret from your facebook app's basic settings.

Methods

facebook.getAuthorizationLink()

returns authorization link which you can attach to your login with facebook button. After successful authorization facebook will redirect user to the redirect link you provided in the constructor with authorization code in query params.

facebook.getUserAccessToken(_authorizationToken)

returns user's access token which is obtained after successful authorization from authorization link above.

facebook.getUserDetails(_accessToken)

returns user's profile info. Function takes in access token which is obtained using getUserAccessToken function.

facebook.getUserLatestPosts(_accessToken)

returns user's latest posts list. Function takes in access token which is obtained using getUserAccessToken function.

facebook.getPostDetails(_postIdentifiers, _accessToken)

returns user's post details list. Function takes in an array of post identifiers, these are obtained using getUserLatestPosts function. Function takes in access token which is obtained using getUserAccessToken function.

Instagram

Before you start you'll need.

  • An Instagram Business Account or Instagram Creator Account
  • A Facebook Page connected to that account
  • A Facebook Developer account that can perform Tasks on that Page
  • A registered Facebook App with Basic settings configured

Configure facebook login for your facebook app with permissions. (https://developers.facebook.com/apps/{your-app-id}/fb-login/settings/)

Add your application's server URL in Valid OAuth Redirect URIs input.

Import Instagram constructor from the sdk. Create Facebook instance.

import { Instagram } from 'socialX';

const instagram = new Instagram({
  apiKey: '',
  apiSecret: '',
  redirectLink: '',
});

You'll find apiKey as App ID and apiSecret as App Secret from your facebook app's basic settings.

Methods

instagram.getAuthorizationLink()

returns authorization link which you can attach to your login with instagram button. After successful authorization instagram will redirect user to the redirect link you provided in the constructor with authorization code in query params.

instagram.getUserAccessToken(_authorizationToken)

returns user's access token which is obtained after successful authorization from authorization link above.

instagram.getUserDetails(_accessToken)

returns user's profile info. Function takes in access token which is obtained using getUserAccessToken function.

instagram.getUserLatestPosts(_accessToken)

returns user's latest posts list. Function takes in access token which is obtained using getUserAccessToken function.

instagram.getPostDetails(_postIdentifiers, _accessToken)

returns user's post details list. Function takes in an array of post identifiers, these are obtained using getUserLatestPosts function. Function takes in access token which is obtained using getUserAccessToken function.

Tiktok

Create Tiktok developer account.

Create Tiktok app. (https://developers.tiktok.com/apps/)

Fill in the basic information on Tiktok application dashboard.

Add login kit and Video kit as product in your Tiktok application.

In login kit find input with label Redirect domain, and add your application server's domain in it.

In Tiktok api section found at the bottom of Tiktok application dashboard. Add user.info.basic and video.list as scopes.

Submit your app for review. Tiktok SDK won't work if your app is not approved.

Import Tiktok constructor from the sdk. Create Tiktok instance.

import { Tiktok } from 'socialX';

const tiktok = new Tiktok({
  clientId: '',
  clientSecret: '',
});

You'll find clientKey and clientSecret from your tiktok application's dashboard.

Methods

tiktok.getAuthorizationLink(_redirectLink)

returns authorization link which you can attach to your login with tiktok button. After successful authorization tiktok will redirect user to the redirect link you provided in function param with authorization code in query params.

tiktok.getUserAccessToken(_authorizationToken)

returns user's access token which is obtained after successful authorization from authorization link above.

tiktok.refreshAccessToken(_refreshToken)

returns user's refreshed access token which is obtained after successful authorization from authorization link above.

tiktok.getUserProfileInfo(_accessToken)

returns user's profile info. Function takes in access token which is obtained using getUserAccessToken function.

tiktok.getUserVideoList(_accessToken, _maxResults?, _sort?)

returns user's latest video list. Function takes in access token which is obtained using getUserAccessToken function.

tiktok.getVideoDetails(_postIdentifiers, _accessToken)

returns user's video details list. Function takes in an array of post identifiers, which can be video ids or video urls.

Twitter

Create twitter developer account. (https://developer.twitter.com/en/portal/petition/essential/basic-info)

You have to apply for developer account in order to use twitter's api service

Create twitter app. (https://developer.twitter.com/en/portal/projects-and-apps)

Get your bearer token by clicking on key icon. (https://developer.twitter.com/en/portal/projects/{projectId}/apps/{appId}/keys)

Import Twitter constructor from the sdk. Create Twitter instance.

import { Twitter } from 'socialX';

const TwitterBearerToken = 'your app bearer token';


const twitter = new Twitter({ apiToken: TwitterBearerToken });

You'll find token as Bearer Token from your twitter Projects and Apps selected app tab.

Methods

twitter.getTweetDetails(_tweetId[])

returns returns details and statistics of tweet with engagements and impressions using list of tweet ids, tweet id can be get from url bar of tweet detail page

twitter.getLatestTweets(_username[])

returns list of most recent 10 tweets of users using username, tweets id can be get from url bar of tweet detail page

twitter.getUserDetails(_userName[])

returns list of user details using list of twitter username, tweets id can be get from url bar of tweet detail page

Youtube

Create gmail account.(https://accounts.google.com/signup/v2/webcreateaccount?flowName=GlifWebSignIn&flowEntry=SignUp)

Create project on Google console. (https://console.cloud.google.com/)

Enable youtube v3 apis from. (https://console.cloud.google.com/apis/library/youtube.googleapis.com)

Create Api key for your app integration from. (https://console.cloud.google.com/apis/credentials)

Import youtube constructor from the sdk. Create youtube instance.

import { Youtube } from 'socialX';

const youtubeBearerToken = 'your app api token';


const youtube = new Youtube({ apiToken: youtubeBearerToken });

You'll find token as Api token from your google console project (https://console.cloud.google.com/apis/credentials).

Methods

youtube.getVideoDetails(_urls[])

returns details of video(s) with engagements and impressions using list of video urls, videos url can be get from url bar of video page youtube.getLatestVideo(_urls[])

returns list of most recent 10 videos of channel(s) using list of video urls, videos url can be get from url bar of video page

youtube.getChannelDetails(_urls[])

returns list of channel details using array of channel urls in an array, videos url can be get from url bar of video page of youtube