├── .gitignore ├── pipcorn.gif ├── make.sh ├── index.js ├── webpack.config.js ├── README.md ├── package.json └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bundled 3 | -------------------------------------------------------------------------------- /pipcorn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JonnyBurger/pipcorn/HEAD/pipcorn.gif -------------------------------------------------------------------------------- /make.sh: -------------------------------------------------------------------------------- 1 | rm -rf bundled 2 | npx webpack 3 | rm -rf bundled/pip.app 4 | mkdir bundled/pip.app 5 | cp -r node_modules/open-pip/pip.app bundled 6 | sed -i -e 's/new Buffer/Buffer.alloc/g' bundled/bundle.js 7 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { promisify } = require("util"); 2 | const { xns } = require("xns"); 3 | const youtubedl = require("ytdl-core"); 4 | const openPip = require("open-pip"); 5 | 6 | const getInfo = promisify(youtubedl.getInfo); 7 | 8 | xns(async () => { 9 | const info = await getInfo(process.argv[2]); 10 | const format = youtubedl.chooseFormat(info.formats, {}); 11 | await openPip(format.url); 12 | await new Promise(resolve => setTimeout(resolve, 3000)); 13 | }); 14 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | const path = require("path"); 3 | 4 | module.exports = { 5 | entry: "./index.js", 6 | output: { 7 | path: path.resolve(__dirname, "bundled"), 8 | filename: "bundle.js", 9 | publicPath: "bundled" 10 | }, 11 | node: { 12 | __dirname: false, 13 | __filename: false 14 | }, 15 | target: "node", 16 | mode: "production", 17 | devtool: "source-map", 18 | plugins: [ 19 | new webpack.BannerPlugin({ 20 | banner: "#! /usr/bin/env node", 21 | raw: true 22 | }) 23 | ] 24 | }; 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🍿 pipcorn 2 | > Watch YouTube videos on your Mac via CLI 3 | 4 | With pipcorn you can spawn a picture-in-picture YouTube player without installing anything! 5 | Simple type the following into the terminal: 6 | 7 | ``` 8 | npx pipcorn https://www.youtube.com/watch?v=jo_B4LTHi3I 9 | ``` 10 | 11 | ![Demo](https://github.com/JonnyBurger/pipcorn/blob/master/pipcorn.gif?raw=true) 12 | 13 | It uses [ytdl-core](https://www.npmjs.com/package/ytdl-core) and [open-pip](https://www.npmjs.com/package/open-pip) under the hood. However they are webpacked so that the program installs fast. 14 | 15 | You can control the video via the Touch Bar of your MacBook. 16 | 17 | 18 | ## License 19 | MIT 20 | 21 | ## Author 22 | [Jonny Burger](https://jonny.io) 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pipcorn", 3 | "version": "1.0.1", 4 | "description": "Watch YouTube videos in picture-in-picture", 5 | "bin": "bundled/bundle.js", 6 | "files": [ 7 | "bundled/bundle.js", 8 | "bundled/pip.app" 9 | ], 10 | "scripts": { 11 | "test": "echo \"Error: no test specified\" && exit 1", 12 | "build": "sh make.sh", 13 | "prepublish": "npm run build" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "git+https://github.com/JonnyBurger/pipcorn.git" 18 | }, 19 | "keywords": [ 20 | "picture", 21 | "in", 22 | "picture", 23 | "youtube" 24 | ], 25 | "author": "Jonny Burger", 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/JonnyBurger/pipcorn/issues" 29 | }, 30 | "homepage": "https://github.com/JonnyBurger/pipcorn#readme", 31 | "devDependencies": { 32 | "open-pip": "^3.0.5", 33 | "webpack": "^4.41.5", 34 | "webpack-cli": "^3.3.10", 35 | "xns": "^2.0.7", 36 | "ytdl-core": "^1.0.6" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 Jonny Burger 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | --------------------------------------------------------------------------------