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

jericho-api

v1.2.2

Published

Multi-Node-Api for Community Based Projects includes Custom-YoutubeApi and Many More Api's Wrappers

Downloads

28

Readme

Multi-Node-Api for Community Based Projects includes Custom-YoutubeApi and Many More Api's Wrappers and Many more will be included if you contact us and suggest us some great apis

Installation

Install jericho-api

$ npm install --save jericho-api

Features

  • Soft and Hard fetch methods Integrated with YoutubeApiLTE Class
  • Package can be used with Commonjs or ES6 Type of Javascript and typings included
  • Added getHomepage() and getTrending() Function and returns Youtube Video Arrays
  • Added .fetch() method for Hard Fetch Type
  • Custom Youtube Wrapper and have many functions to fetch data
  • Better Event Handlers and Request Handlers
  • Better Body Parsing for Incomplete request ( HTTP Post Request )

Documentation

Schemes :

Youtube Video Scheme :

YoutubeVideo {
  Id: 1,
  videoId: '9UMxZofMNbA',
  title: 'Chillout Lounge - Calm & Relaxing Background Music | Study, Work, Sleep, Meditation, Chill',
  description: 'Short Description here [Edited for Scheme]',
  duration_raw: '00:00',
  duration: 0,
  url: 'https://www.youtube.com/watch?v=9UMxZofMNbA',
  uploadedAt: 'Started streaming on Jun 13, 2021',
  views: 12902240,
  thumbnail: YoutubeThumbnail {
    thumbnailId: '9UMxZofMNbA',
    width: 1920,
    height: 1080,
    url: 'https://i.ytimg.com/vi/9UMxZofMNbA/maxresdefault.jpg?v=60c5e7c1'
  },
  channel: YoutubeChannel {
    name: 'The Good Life Radio x Sensual Musique',
    verified: false,
    channelId: 'UChs0pSaEoNLV4mevBFGaoKA',
    icon: {
      url: 'https://yt3.ggpht.com/ytc/AKedOLRolK5uaMIsmYQV2cHzxxC8qSCH5aQ18O3_PMJHwQ=s48-c-k-c0x00ffffff-no-rj',
      width: 48,
      height: 48
    },
    subscribers: '674K',
    url: 'https://www.youtube.com/channel/UChs0pSaEoNLV4mevBFGaoKA'
  },
  likes: 109710,
  dislikes: 0,
  islive: true,
  isprivate: false,
  tags: [
    'chill-out music',
    'chill music',
    'chillout',
    'chill house',
    'chill',
    'out',
    'music',
    'deep house',
    'deep',
    'house',
    'house music',
    'dance music',
    'edm',
    'electronic dance music',
    'the good life radio',
    'the good life'
  ],
  suggestionVideos: [ ...YoutubeVideo[] ]
  // Here Recommendation Videos will be spotted But with soft fetch only | But you can fetch its total data by indivually -> <YoutubeVideo>.fetch() or fetch together by ->  <YoutubeApiLTE>.getVideo(Url , searchOptions , true) and it will return hard fetch videos
}

Examples :

YoutubeApiLTE Class Example :

const { YoutubeApiLTE } = require("jericho-api");

/**
 * searchOptions -> Search Options for <YoutubeApiLTE>.search() method
 *
 * (@) We are giving headers for "User-Agent" But you can also give other or left it as undefined or enable "randomUserAgents": true
 * (@) Search Options helps to filter the search results for Search Query URL and Axios get Response
 */
var searchOptions = {
  AxiosHttpRequestConfigs: {
    headers: {
      "User-Agent":
        "Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0",
    },
  },
};

/**
 * YoutubeInstance -> YoutubeInstance has been been created and all methods of Api calls will be used with it
 */

var YoutubeInstance = new YoutubeApiLTE(searchOptions);

/**
 * Youtube_Video -> Fetching Video Metadata from Search Result and also added <YoutubeVideo>.fetch() to get all exact Hard fetched Data ("You can ignore fetch if you are okay with search results or Soft Data")
 */
var Youtube_Video = new Promise(async (resolve) => {
  /**
   * <YoutubeApiLTE>.search() function has been called here to fetch Search Results Data
   *
   * (@) Added Default "searchOptions" But its choice based
   * (@) Added limit : 2 , To make only 2 Data or else you can give 1 and 0 for Infinty
   * (@) Added type : 'video' , Filter Parsing in <Axios>.get() Search Query URL | Choices -> "channel","playlist","video","all"
   */
  var Youtube_Video_Data = await YoutubeInstance.search(`Despacito`, {
    ...searchOptions,
    type: "all",
    limit: 2,
  });

  /**
   * Youtube_Video_Data -> Checking for its validity as a Data because Search Result will give usually you search for it in Youtube
   */
  if (!(Youtube_Video_Data?.[0] && Youtube_Video_Data?.[0]?.type === "video"))
    resolve(undefined);
  else {
    /**
     * <YoutubeVideo>.fetch()
     *
     * (@) Hard Fetching Data and parse it on same Instance to avoid buffer overflow and memory leaks
     * (@) if you encounter "429" Erros , you can use cookies and proxies or diffrent user-agent to fetch data through 'Axios'
     */
    await Youtube_Video_Data[0].fetch(searchOptions?.AxiosHttpRequestConfigs);
  }

  resolve(Youtube_Video_Data);
});

/**
 * Youtube_Video -> Fetched <YoutubeVideo> Class Instance
 */
console.log(Youtube_Video);

Cookies with YoutubeApiLTE :

var searchOptions = {
  AxiosHttpRequestConfigs: {
    cookie:
      "xxxx=xyz-secret-youtube-cookie-browser-network-inspect-as-string-xxxx=xyznc",
  },
};

// OR

var searchOptions = {
  AxiosHttpRequestConfigs: {
    cookies:
      "xxxx=xyz-secret-youtube-cookie-browser-network-inspect-as-string-xxxx=xyznc",
  },
};

Proxy with YoutubeApiLTE :

var searchOptions = {
  AxiosHttpRequestConfigs: {
    proxy: "https://www.goggle.com:456",
  },
};

// OR

var searchOptions = {
  AxiosHttpRequestConfigs: {
    proxy: { host: "www.google.com", port: 456 },
  },
};

User-Agents with YoutubeApiLTE :

var searchOptions = {
  AxiosHttpRequestConfigs: {
    headers: {
      "User-Agent":
        "Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0",
    },
  },
};

AxiosHTTPConfigs with YoutubeApiLTE :

var searchOptions = {
  AxiosHttpRequestConfigs: {},
};

Links