pompalamasyon
v1.0.0
Published
DisTube fork of ytdl-core. YouTube video downloader in pure javascript.
Downloads
61
npm package discovery and stats viewer.
[free text search, go nuts!]
pkg:[package-name]
@[username]
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.
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.
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 🙏
next / express / next-routes
redux / react-redux / next-redux-wrapper / redux-thunk / redux-logger
babel-plugin-module-resolver / babel-plugin-styled-components
© 2024 – Pkg Stats / Ryan Hefner
DisTube fork of ytdl-core. YouTube video downloader in pure javascript.
Downloads
61
ytdl-core
. This fork is dedicated to fixing bugs and adding features that are not merged into the original repo as soon as possible. ## Installation bash npm install @distube/ytdl-core@latest
Make sure you're installing the latest version of @distube/ytdl-core
to keep up with the latest fixes. ## Usage js const ytdl = require("@distube/ytdl-core"); // TypeScript: import ytdl from '@distube/ytdl-core'; with --esModuleInterop // TypeScript: import * as ytdl from '@distube/ytdl-core'; with --allowSyntheticDefaultImports // TypeScript: import ytdl = require('@distube/ytdl-core'); with neither of the above // Download a video ytdl("http://www.youtube.com/watch?v=aqz-KE-bpKQ").pipe(require("fs").createWriteStream("video.mp4")); // Get video info ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ").then(info => { console.log(info.videoDetails.title); }); // Get video info with download formats ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ").then(info => { console.log(info.formats); });
### Cookies Support js const ytdl = require("@distube/ytdl-core"); // (Optional) Below are examples, NOT the recommended options const cookies = [ { name: "cookie1", value: "COOKIE1_HERE" }, { name: "cookie2", value: "COOKIE2_HERE" }, ]; // (Optional) http-cookie-agent / undici agent options // Below are examples, NOT the recommended options const agentOptions = { pipelining: 5, maxRedirections: 0, localAddress: "127.0.0.1", }; // agent should be created once if you don't want to change your cookie const agent = ytdl.createAgent(cookies, agentOptions); ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent }); ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
#### How to get cookies - Install EditThisCookie extension for your browser. - Go to YouTube. - Log in to your account. (You should use a new account for this purpose) - Click on the extension icon and click "Export" icon. - Your cookies will be added to your clipboard and paste it into your code. > [!WARNING] > Don't logout it by clicking logout button on youtube/google account manager, it will expire your cookies. > You can delete your browser's cookies to log it out on your browser. > Or use incognito mode to get your cookies then close it. > [!WARNING] > Paste all the cookies array from clipboard into createAgent
function. Don't remove/edit any cookies if you don't know what you're doing. > [!WARNING] > Make sure your account, which logged in when you getting your cookies, use 1 IP at the same time only. It will make your cookies alive longer. js const ytdl = require("@distube/ytdl-core"); const agent = ytdl.createAgent([ { domain: ".youtube.com", expirationDate: 1234567890, hostOnly: false, httpOnly: true, name: "---xxx---", path: "/", sameSite: "no_restriction", secure: true, session: false, value: "---xxx---", }, { "...": "...", }, ]);
- Or you can paste your cookies array into a file and use fs.readFileSync
to read it. js const ytdl = require("@distube/ytdl-core"); const fs = require("fs"); const agent = ytdl.createAgent(JSON.parse(fs.readFileSync("cookies.json")));
### Proxy Support js const ytdl = require("@distube/ytdl-core"); const agent = ytdl.createProxyAgent({ uri: "my.proxy.server" }); ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent }); ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
Use both proxy and cookies: js const ytdl = require("@distube/ytdl-core"); const agent = ytdl.createProxyAgent({ uri: "my.proxy.server" }, [{ name: "cookie", value: "COOKIE_HERE" }]); ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent }); ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
### IP Rotation Built-in ip rotation (getRandomIPv6
) won't be updated and will be removed in the future, create your own ip rotation instead. To implement IP rotation, you need to assign the desired IP address to the localAddress
property within undici.Agent.Options
. Therefore, you'll need to use a different ytdl.Agent
for each IP address you want to use. ```js const ytdl = require("@distube/ytdl-core"); const { getRandomIPv6 } = require("@distube/ytdl-core/lib/utils"); const agentForARandomIP = ytdl.createAgent(undefined, { localAddress: getRandomIPv6("2001:2::/48"), }); ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent: agentForARandomIP }); const agentForAnotherRandomIP = ytdl.createAgent(undefined, { localAddress: getRandomIPv6("2001:2::/48"), }); ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ",