Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ytsr

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ytsr

Do anonymous YouTube search requests.

  • 0.1.18
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1K
decreased by-15.52%
Maintainers
1
Weekly downloads
 
Created
Source

NPM version NPM downloads Dependencies Dependencies Discord

NPM info

node-ytsr

Simple js only module to search YouTube Doesn't need any login or GoogleAPI key

Usage

const ytsr = require('ytsr');
let filter;

ytsr.getFilters('github', function(err, filters) {
  if(err) throw err;
  filter = filters.get('Type').find(o => o.name === 'Video');
  ytsr.getFilters(filter.ref, function(err, filters) {
    if(err) throw err;
    filter = filters.get('Duration').find(o => o.name.startsWith('Short'));
    var options = {
      limit: 5,
      nextpageRef: filter.ref,
    }
    ytsr(null, options, function(err, searchResults) {
      if(err) throw err;
      dosth(searchResults);
    });
  });
});

API

ytsr(searchString, [options, callback])

Searches for the given string

  • searchString

    • string to search for
  • options

    • object with options
    • possible settings:
    • safeSearch[Boolean] -> pull items in youtube restriction mode.
    • limit[integer] -> limits the pulled items
    • nextpageRef[String] -> if u wanna continue a previous search or use filters
  • callback(err, result)

    • function
    • getting fired after the request is done
    • contains an error or a result
  • returns a Promise when no callback is defined

  • Example response

ytsr.getFilters(searchString, [callback])

Pulls avaible filters for the given string/ref

  • searchString

    • string to search for
    • or previously optained filter ref
  • callback(err, result)

    • function
    • getting fired after the request is done
    • contains an error or a result
  • returns a Promise when no callback is defined

  • Example response

Install

npm install --save ytsr

License

MIT

Keywords

FAQs

Package last updated on 22 Jul 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc