From be1a6334f17cb71085038047b274c599db403ccb Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 15 Jan 2023 13:51:51 +0200 Subject: [PATCH] youtube to mp3 --- User-Menu-Cookbook.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/User-Menu-Cookbook.md b/User-Menu-Cookbook.md index 0150825..d442fda 100644 --- a/User-Menu-Cookbook.md +++ b/User-Menu-Cookbook.md @@ -49,6 +49,49 @@ export default { } ``` +## Convert YouTube to `mp3` + +```js +export default { + 'Y - Youtube to mp3': async ({CloudCmd, DOM}) => { + const {View} = CloudCmd; + const {Dialog} = DOM; + + const [, url] = await Dialog.prompt('YouTube URL:'); + + if (!url) + return; + + const {default: createElement} = await import('https://cdn.skypack.dev/@cloudcmd/create-element') + + const element = createElement('iframe', { + id: 'youtube-to-mp3', + width: '100%', + height: '100%', + src: `https://convert2mp3s.com/api/single/mp3?url=${url}`, + allowtransparency:"true" , + scrolling: 'no', + style: 'border: none;', + notAppend: true, + }); + + createElement('style', { + parent: document.head, + dataName: 'youtube-to-mp3-style', + textContent: ` + .view:has(#youtube-to-mp3) { + overflow: hidden + } + ` + }); + + View.show(element, { + autoSize: true, + }); + }, +} +``` + ## Convert `*.flac` or `*.mp4` to `*.mp3` and put to `mp3` directory. Simple example of running bash scripts with help of `TerminalRun`.