A simple Node.js command-line tool that automates the process of generating a <video>
HTML tag for embedding videos from Nextcloud into applications like Obsidian.md. It parses a Nautilus WebDAV file path, creates a share link using Nextcloud APIs, and outputs the final <video>
tag with a direct download link.
- Node.js: Version 20 or newer is required for the native
fetch
API support and experimental support for .envfiles. - Nextcloud Account: Access to a Nextcloud instance with appropriate permissions.
- Nautilus (GNOME Files): If you're using Nautilus WebDAV paths.
-
Clone the Repository
-
Install Dependencies
npm install
-
Set Up Environment Variables
Note you have to create a app-password for Nextcloud WebDAV
cp .env.example .env
touch .env # add Nextcloud credentials
./index.js "<nautilus_webdav_file_path>"
# or
node --env-file=.env index.js "<nautilus_webdav_file_path>"
./index.js "/run/user/1000/gvfs/dav:host=cloud.domain.dev,ssl=true,user=Admin,prefix=%2Fremote.php%2Fwebdav/Videos/sample-video.mp4"
# output
<video src="https://cloud.domain.dev/s/kCrncbqTSKLr6/download/sample-video.mp4" controls width="300"></video>
This project is licensed under the MIT License.