
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
youtube-sr
Advanced tools
Simple package to make YouTube search.
youtube-srworks well with Bun runtime with zero configuration.
youtube-srdepends upon thefetchAPI. It by default picks thefetchapi from window or global object. You may have to installfetchapi in nodejs.youtube-srsupports undici, node-fetch & cross-fetch. You don't have to add anything to the code.youtube-srtries to resolve these libs itself.
$ npm i --save youtube-sr # via npm
$ yarn add youtube-sr # yarn
$ pnpm add youtube-sr # pnpm
const YouTube = require("youtube-sr").default;
import YouTube from "https://deno.land/x/youtube_sr/mod.ts";
const videos = await YouTube.search("playing with fire", { limit: 3 });
console.log(videos.map((m, i) => `[${++i}] ${m.title} (${m.url})`).join("\n"));
/*
[1] BLACKPINK - '불장난 (PLAYING WITH FIRE)' M/V (https://www.youtube.com/watch?v=9pdj4iJD08s)
[2] BLACKPINK - ‘불장난(PLAYING WITH FIRE)’ DANCE PRACTICE VIDEO (https://www.youtube.com/watch?v=NvWfJTbrTBY)
[3] BLACKPINK - PLAYING WITH FIRE (불장난) [Color Coded Han|Rom|Eng] (https://www.youtube.com/watch?v=PT0mv-4IL4M)
*/
YouTube.search("some nsfw query", { limit: 3, safeSearch: true })
.then((x) => console.log(x))
.catch(console.error);
Used to search videos/channels/playlists. This works like a general YouTube search.
YouTube.search("the weeknd save your tears")
.then((vids) => console.log(vids.map((m) => m.url))) // ["https://www.youtube.com/watch?v=XXXXXXX", ...]
.catch(console.error);
Similar to search but makes single search.
YouTube.searchOne("the weeknd save your tears")
.then((res) => console.log(res.url)) // https://www.youtube.com/watch?v=XXXXXXX
.catch(console.error);
Returns playlist info.
Note: Data returned by
getPlaylistis different from the playlist data obtained bysearch. Usinglimitinoptionswont fetch all videos. They are for current chunk only! UsefetchAll: truein order to fetch all videos. >limitwithfetchAllwill limit the videos for whole playlist. However,limitmay not be always accurate.
Basic
YouTube.getPlaylist("some_youtube_playlist")
.then(console.log) // max 100 items
.catch(console.error);
Fetch all videos immediately
YouTube.getPlaylist("some_youtube_playlist", { fetchAll: true }).then(console.log).catch(console.error);
Getting all videos from a playlist at once manually
YouTube.getPlaylist("some_youtube_playlist")
.then((playlist) => playlist.fetch()) // if your playlist has 500 videos, this makes additional 4 requests to get rest of the 400 videos. (100 videos = 1 request)
.then(console.log) // all parsable videos
.catch(console.error);
Lazily getting videos from a playlist
YouTube.getPlaylist("some_youtube_playlist")
.then((playlist) => playlist.next()) // fetches next 100 items
.then(console.log) // all parsable videos
.catch(console.error);
Returns basic video info by its url.
Note: Data returned by
getVideois different from thesearch.shortsproperty of the video object might not be 100% accurate.
YouTube.getVideo("Some_Video_URL")
.then(console.log) // Video info
.catch(console.error);
Returns videos from the YouTube homepage.
YouTube.homepage()
.then(console.log) // videos from youtube homepage
.catch(console.error);
Returns trending videos from the YouTube.
YouTube.trending()
.then(console.log) // trending videos from youtube
.catch(console.error);
Returns 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'
]
*/
Used to validate url/id.
[
Video {
id: 'K5KAc5CoCuk',
title: 'Indila - Dernière Danse (Clip Officiel)',
description: 'Compositeurs: ',
durationFormatted: '3:35',
duration: 215000,
uploadedAt: '7 years ago',
views: 714624838,
shorts: false,
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,
shorts: false,
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,
shorts: false,
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: []
}
]
Join my discord server https://discord.gg/CR8JxrxSwr
FAQs
Simple package to make YouTube search.
The npm package youtube-sr receives a total of 2,885 weekly downloads. As such, youtube-sr popularity was classified as popular.
We found that youtube-sr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.

Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.

Research
A malicious package uses a QR code as steganography in an innovative technique.

Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.