
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
sort-youtube-videos
Advanced tools
Additional sorting options for YouTube channel videos.
Demo coming soon!!!
Support development of this project.
YouTube only offers few sorting options, But, I want to use some other sorting options like Sort videos by least viewed video to most viewed video, sort by video duration, etc...
No API key is required
npm i sort-youtube-videos
with yarn:
yarn add sort-youtube-videos
| Parameter | Description | required |
|---|---|---|
| URL | YouTube channel url or channel Id | true |
| sorting options | Default option lh to sort videos from least viewed videos to most viewed videos, hl to sort videos from Most popular upload to least popular upload | false |
const { sortByViews } = require("sort-youtube-videos");
// import { sortLowToHigh } from "sort-youtube-videos"
const url = "https://www.youtube.com/channel/UC5RRWuMJu7yP1DQwnW_nAvA"; //url or channel id
//Sort by views low to high
sortByViews(url).then((res) => console.log(res));
// response type
[
{
type: "video",
title: "#shorts",
videoId: "DOrVURA_O90",
author: "Anas and Ammar",
authorId: "UC5RRWuMJu7yP1DQwnW_nAvA",
videoThumbnails: [[Object], [Object], [Object], [Object]],
viewCountText: "10 views",
viewCount: 17,
publishedText: "4 months ago",
durationText: "0:57",
lengthSeconds: 57,
liveNow: false,
premiere: false,
premium: false,
},
{
type: "video",
title: "Ramzan Ki Shan Episode 04",
videoId: "7VO4ZLBVQiY",
author: "Anas and Ammar",
authorId: "UC5RRWuMJu7yP1DQwnW_nAvA",
videoThumbnails: [[Object], [Object], [Object], [Object]],
viewCountText: "17 views",
viewCount: 17,
publishedText: "5 months ago",
durationText: "8:08",
lengthSeconds: 488,
liveNow: false,
premiere: false,
premium: false,
},
// ... 109 more items
];
| Parameter | Description | required |
|---|---|---|
| URL | YouTube channel url or channel Id | true |
| sorting options | Two sorting options are available: Default sl (short -> long) and ls (long -> short) | false |
const { sortByDuration } = require("sort-youtube-videos");
// import { sortByDuration } "sort-youtube-videos";
const url = "https://www.youtube.com/channel/UC5RRWuMJu7yP1DQwnW_nAvA"; //url or channel id
const sortBy = "sl"; // options: sl - ls
sortByDuration(url, sortBy).then((res) => console.log(res));
// response type
[
{
type: "video",
title: "Ramadan Ki Shan Episode 11 Digitally Presented by Spiced Foods",
videoId: "dgoBBYbSKUQ",
author: "Anas and Ammar",
authorId: "UC5RRWuMJu7yP1DQwnW_nAvA",
videoThumbnails: [[Object], [Object], [Object], [Object]],
viewCountText: "15 views",
viewCount: 15,
publishedText: "5 months ago",
durationText: "4:09",
lengthSeconds: 249,
liveNow: false,
premiere: false,
premium: false,
},
{
type: "video",
title:
"Watch latest movies, web series and TV channels for free without any subscription ||Android",
videoId: "ummVLFK17GI",
author: "Anas and Ammar",
authorId: "UC5RRWuMJu7yP1DQwnW_nAvA",
videoThumbnails: [[Object], [Object], [Object], [Object]],
viewCountText: "16 views",
viewCount: 16,
publishedText: "1 year ago",
durationText: "4:11",
lengthSeconds: 251,
liveNow: false,
premiere: false,
premium: false,
},
// ... 109 more items
];
| Parameter | Description | required |
|---|---|---|
| Channel Name | To get YouTube channel name | true |
const { search_channel } = require("sort-youtube-videos");
// import { search_channel } from "sort-youtube-videos";
const channelName = "Codestick"; // YouTube channel name
search_channel(channelName).then((res) => console.log(res));
// response type
// return all channel with this name
[
{
channelId: "UCYGZ4todIWGIUS1B8ZjML1w",
description: "Learn Coding... Happy Coding.....",
link: "https://www.youtube.com/channel/UCYGZ4todIWGIUS1B8ZjML1w",
thumbnails: [[Object], [Object]],
subscribed: false,
uploadedVideos: 57,
verified: false,
},
{
channelId: "UCae4VwFs7LtQimLOhk6Gdow",
description: "",
link: "https://www.youtube.com/channel/UCae4VwFs7LtQimLOhk6Gdow",
thumbnails: [[Object], [Object]],
subscribed: false,
uploadedVideos: 2,
verified: false,
},
// all channels with this name
];
1 view - 1M views) sortByViews(url);duration (shortest duration to longest duration and longest duration to shortest duration ) sortByDuration(channelName);Pull requests are welcome.
FAQs
sort youtube videos
We found that sort-youtube-videos demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.