Skip to content

rodhfr/silverbullet-ytinfo

Repository files navigation

SilverBullet YTinfo

Get and write metadata like title, author and description from YouTube videos using Invidious API.

Installation

Silverbullet v2 (required)

Add "ghr:rodhfr/silverbullet-ytinfo/ytinfo.plug.js" to your plugin list in CONFIG page:

config.set {
  plugs = {
    "github:rodhfr/silverbullet-ytinfo/ytinfo.plug.js"
  }
}

if you have more than one plugin you need to separate them with "," as this is an array.

    "ghr:rodhfr/silverbullet-ytinfo/ytinfo.plug.js",
    "ghr:user/someotherplugin/plugin.plug.js"

Run Plugs: Update Update hotkey is cmd+shift+p or launch cmd + / then search for Plugs Update.

Usage

cmd + / for the launcher and search Youtube: New Watch it will prompt for the YouTube link.

Create video watchlist using #watch tags.

Write this code into your page and is possible to search for all instances of videos in watchlist.

${template.each(query[[
from index.tag "watch"
order by ref
where not _.done
limit 30
]], templates.taskItem)}

Using objects query in template pages

${"$"} prevents variables to expand in the template. With this you can dinamically add your watchlist to your daily page template for example.

* # WATCHLIST 🎬
${"$"}{template.each(query[[
from index.tag "watch"
order by ref
where not _.done
limit 30
]], templates.taskItem)}

Customize

Slashcommands define

You can create your own slashcommands using the addon's builtin functions like Youtube: New Watch.

slashCommand.define {
  name = "newvideo",
  run = function()
    editor.invokeCommand("Youtube: New Watch")
  end
}

Build

To build this plug, make sure you have Deno installed. Then, build the plug with:

deno task build

Then, copy the resulting .plug.js file into your space's _plug folder. Or build and copy in one command:

deno task build && cp *.plug.js /my/space/_plug/

SilverBullet will automatically sync and load the new version of the plug, just watch your browser's JavaScript console to see when this happens.

Manual Installation

Copy ytinfo.plug.js to silverbullet/_plugs/ and wait for it to autoupdate, it doesn't need to manually run Plugs: Update. Running Plugs: Update erases the ytinfo.plug.js.

Functions

  • Youtube: New Watch: requests video information from invidious server using youtube video id then write hyperlinked video title and optionally thumbnail with #watch tag.

About

Get and write metadata like title, author and description from YouTube videos using Invidious API.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors