youtube-sr

A dead-simple youtube metadata scraper

MIT License

Downloads
23K
Stars
111
Committers
16

Bot releases are visible (Hide)

youtube-sr - 4.1.11

Published by twlite almost 3 years ago

Updates

  • add support for undici and node-fetch for nodejs
  • better deno build

Full Changelog: https://github.com/DevAndromeda/youtube-sr/compare/v4.1.10...v4.1.11

youtube-sr - 4.1.10

Published by twlite almost 3 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/DevSnowflake/youtube-sr/compare/v4.1.9...v4.1.10

youtube-sr - 4.1.9

Published by twlite almost 3 years ago

  • revert back to node-fetch

Full Changelog: https://github.com/DevSnowflake/youtube-sr/compare/v4.1.8...v4.1.9

youtube-sr - v4.1.8

Published by twlite about 3 years ago

Updates

  • replaced node-fetch with undici
  • added esm exports
youtube-sr - v4.1.7

Published by twlite over 3 years ago

Updates

  • fix video object from getVideo's duration not being ms #27
youtube-sr - v4.1.6

Published by twlite over 3 years ago

Updates

  • Fixed TypeError: Cannot read property 'simpleText' of undefined on YouTube.getVideo
youtube-sr - v4.1.5

Published by twlite over 3 years ago

Updates

  • Fix typings for searchOne
  • Adds user agent header by default
  • New getSuggestions method to get youtube search suggestions
YouTube.getSuggestions("alan walker")
  .then(console.log);

/*
[
  'alan walker',
  'alan walker songs',
  'alan walker faded',
  'alan walker alone',
  'alan walker remix',
  'alan walker spectre',
  'alan walker on my way',
  'alan walker new song',
  'alan walker lily',
  'alan walker darkside',
  'alan walker pubg song',
  'alan walker ringtone',
  'alan walker ignite',
  'alan walker live',
  'k'
]
*/
youtube-sr - v4.1.4

Published by twlite over 3 years ago

Fix

  • Playlist issue #25
  • playlist update date
youtube-sr - v4.1.3

Published by twlite over 3 years ago

Fix

  • similar videos parse error on age restricted videos (#23)
youtube-sr - v4.1.2

Published by twlite over 3 years ago

Updates

  • new YouTube.trending() method
youtube-sr - v4.1.1

Published by twlite over 3 years ago

Updates

  • fix: known bug with playlist index
youtube-sr - v4.1.0

Published by twlite over 3 years ago

Updates

  • new YouTube.homepage() method
youtube-sr - v4.0.10

Published by twlite over 3 years ago

Playlist

  • .next() method returns next 100 videos
  • .fetch() fetches every items that can be parsed
youtube-sr - v4.0.9

Published by twlite over 3 years ago

Updates

  • YouTube.getVideo should now include related videos/upcoming videos/suggested videos
const video = await YouTube.getVideo("some_video_url");
const upNext = video.videos[0].title;

console.log(`The upcoming video is ${upNext}`);
youtube-sr - v4.0.8

Published by twlite over 3 years ago

Changes

  • some minor updates
youtube-sr - v4.0.7

Published by twlite over 3 years ago

  • Removed API support
  • Sync deno version with node
youtube-sr - v4.0.6

Published by twlite over 3 years ago

  • fix thumbnail (#19)
youtube-sr - v4.0.4

Published by twlite over 3 years ago

  • some updates
youtube-sr - v4.0.3

Published by twlite over 3 years ago

  • YouTube.isPlaylist(src) to validate playlists
youtube-sr - v4.0.2

Published by twlite over 3 years ago

Updates

  • api support

YouTube Search

Simple package to search videos or channels on YouTube.

Features

  • Easy
  • Simple
  • Fast
  • Both scraper & api support
  • Single api for scraper & api methods

Installation

Node

Minimum node version required to run this library is v14.x

$ npm i youtube-sr
const YouTube = require("youtube-sr").default;

Example

Note: Data might be different for API search & Scraper Search

Search

YouTube.search("indila last dance", { limit: 3 })
    .then(x => console.log(x))
    .catch(console.error);

Safe Search

YouTube.search("indila last dance", { limit: 3, safeSearch: true })
    .then(x => console.log(x))
    .catch(console.error);

API method

// This is how you enable API mode. If you want to disable API mode, set api to false or use YouTube.delete("api")
YouTube.set("api", "YOUR_YOUTUBE_API_KEY");

// regular method
YouTube.search("indila last dance", { limit: 3 })
    .then(x => console.log(x))
    .catch(console.error);

API

search(query, options?)

Used to search videos/channels/playlists.

searchOne(query, options?)

Similar to search but makes single search.

getPlaylist(query, options?)

Returns playlist info.

getVideo(url, options?)

Returns basic video info.

validate(src, type)

Used to validate url/id.

Response Example

[
  Video {
    id: 'K5KAc5CoCuk',
    title: 'Indila - Dernière Danse (Clip Officiel)',
    description: 'Compositeurs: ',
    durationFormatted: '3:35',
    duration: 215000,
    uploadedAt: '7 years ago',
    views: 714624838,
    thumbnail: Thumbnail {
      id: 'K5KAc5CoCuk',
      width: 720,
      height: 404,
      url: 'https://i.ytimg.com/vi/K5KAc5CoCuk/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBBognlttPrCx9VCmx6P_nSW2LREw'
    },
    channel: Channel {
      name: 'Indila',
      verified: true,
      id: 'UCX4EBb-NmxyntI0mQAErHvQ',
      url: 'https://www.youtube.com/channel/UCX4EBb-NmxyntI0mQAErHvQ',
      icon: [Object],
      subscribers: null
    },
    likes: 0,
    dislikes: 0,
    live: false,
    private: false,
    tags: []
  },
  Video {
    id: '1ox1GvNiwtc',
    title: 'Indila - dernière danse (last dance) english lyrics',
    description: 'If you liked this beautiful song, then mind an leave a thumbs up, and hit "Subscribe" for more videos,and share to make our videos ...',
    durationFormatted: '3:33',
    duration: 213000,
    uploadedAt: '6 years ago',
    views: 2004026,
    thumbnail: Thumbnail {
      id: '1ox1GvNiwtc',
      width: 720,
      height: 404,
      url: 'https://i.ytimg.com/vi/1ox1GvNiwtc/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDVTH3SyGIvvPWm-zcDT3X1uEZ7cQ'
    },
    channel: Channel {
      name: 'Freegs Box',
      verified: false,
      id: 'UCzgz8LIN-qjjVEqjKWGktiw',
      url: 'https://www.youtube.com/user/medpks',
      icon: [Object],
      subscribers: null
    },
    likes: 0,
    dislikes: 0,
    live: false,
    private: false,
    tags: []
  },
  Video {
    id: 'UN4VLmo1QG4',
    title: 'Indila - Dernière Danse (Lyrics)',
    description: 'I take requests just comment! Artist: ',
    durationFormatted: '3:32',
    duration: 212000,
    uploadedAt: '11 months ago',
    views: 1843719,
    thumbnail: Thumbnail {
      id: 'UN4VLmo1QG4',
      width: 720,
      height: 404,
      url: 'https://i.ytimg.com/vi/UN4VLmo1QG4/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDCaFr-i5MJrLSlclRRKSliEJ33lw'
    },
    channel: Channel {
      name: 'Audioandlyrics',
      verified: false,
      id: 'UChWcegNjI5qZV-8jBgFAJ6A',
      url: 'https://www.youtube.com/channel/UChWcegNjI5qZV-8jBgFAJ6A',
      icon: [Object],
      subscribers: null
    },
    likes: 0,
    dislikes: 0,
    live: false,
    private: false,
    tags: []
  }
]

Similar Packages

Join my discord server

https://discord.gg/2SUybzb

Package Rankings
Top 5.69% on Deno.land
Top 2.32% on Npmjs.org
Related Projects