diff --git a/widgets/nebula-videos/README.md b/widgets/nebula-videos/README.md new file mode 100644 index 00000000..4ade297f --- /dev/null +++ b/widgets/nebula-videos/README.md @@ -0,0 +1,144 @@ +# Nebula Videos Widget + +Glance widget to display the latest [Nebula](https://nebula.tv/) videos from selected creators/channels. + +## Carousel Style + +![widget screenshot](preview.png) + +```yaml +- type: custom-api + title: Nebula + title-url: https://nebula.tv/ + cache: 1h + frameless: true + url: https://content.api.nebula.app/video_episodes/ + parameters: + ordering: -published_at + page_size: "100" + options: + max_items: 12 + channel-ids: + - video_channel:9cea6296-223e-4c7e-a245-d96db75de32f # Jet Lag: The Game + - video_channel:8f3a2a56-3f9f-4ce0-b105-ede41688d84b # Half as Interesting + - video_channel:fe4d9c1c-017b-494c-9afc-e79e6859b211 # Wendover Productions + template: | + {{ if ne .Response.StatusCode 200 }} +
Failed to fetch Nebula videos.
+ {{ else }} + {{ $channels := .Options.JSON "channel-ids" }} + {{ $maxItems := (index .Options "max_items") }} + {{ if not $maxItems }}{{ $maxItems = 12 }}{{ end }} + {{ $shown := 0 }} + + {{ end }` +``` + +## List Style + +widget screenshot + +```yaml +- type: custom-api + title: Nebula + title-url: https://nebula.tv/ + cache: 1h + frameless: true + url: https://content.api.nebula.app/video_episodes/ + parameters: + ordering: -published_at + page_size: "100" + options: + max_items: 12 + collapse_after: 5 + channel-ids: + - video_channel:9cea6296-223e-4c7e-a245-d96db75de32f # Jet Lag: The Game + - video_channel:8f3a2a56-3f9f-4ce0-b105-ede41688d84b # Half as Interesting + - video_channel:fe4d9c1c-017b-494c-9afc-e79e6859b211 # Wendover Productions + template: | + {{ if ne .Response.StatusCode 200 }} +
Failed to fetch Nebula videos.
+ {{ else }} + {{ $channels := .Options.JSON "channel-ids" }} + {{ $maxItems := (index .Options "max_items") }} + {{ $collapseAfter := (index .Options "collapse_after") }} + {{ if not $maxItems }}{{ $maxItems = 12 }}{{ end }} + {{ if not $collapseAfter }}{{ $collapseAfter = 5 }}{{ end }} + {{ $shown := 0 }} + + + {{ end }} +``` + +### Configuring + +- `max_items`: maximum number of videos to render (default: `12`) +- `collapse_after`: list-only collapse threshold (default: `5`) +- `channel-ids`: only include videos from these channel IDs + +#### How to find a channel ID +1. Go to the channel's page on Nebula (e.g. https://nebula.tv/channel/half-as-interesting) +2. Open dev tools and go to the Network tab +3. Refresh the page and look for a request to `https://content.api.nebula.app/video_channels/` (you can filter by "video_channels" in the Network tab) +4. Click on that request and look at the "Response" tab, where you'll see a request which includes the channel ID (e.g. `video_channel:8f3a2a56-3f9f-4ce0-b105-ede41688d84b` for Half as Interesting). It can look something like this: ![channel_id_screenshot](find_channel_id_devtools.png) + +## Notes +- The Nebula endpoint for the latest videos only fetches 100 at most, meaning that sometimes you won't hit the maximum item count (depending on how many channel ids you have and frequency of video releases) +- This endpoint is not officially supported and there is no public Nebula API, so it may break at any time if they change their internal APIs. Please use this API carefully and do not make excessive requests to it. diff --git a/widgets/nebula-videos/find_channel_id_devtools.png b/widgets/nebula-videos/find_channel_id_devtools.png new file mode 100644 index 00000000..7351f8c6 Binary files /dev/null and b/widgets/nebula-videos/find_channel_id_devtools.png differ diff --git a/widgets/nebula-videos/meta.yml b/widgets/nebula-videos/meta.yml new file mode 100644 index 00000000..a7f5af05 --- /dev/null +++ b/widgets/nebula-videos/meta.yml @@ -0,0 +1,3 @@ +title: Nebula Latest Videos +description: A widget that displays the latest videos from selected [Nebula](https://nebula.tv/) channels. +author: darius-it \ No newline at end of file diff --git a/widgets/nebula-videos/preview-list.png b/widgets/nebula-videos/preview-list.png new file mode 100644 index 00000000..82a9c2cc Binary files /dev/null and b/widgets/nebula-videos/preview-list.png differ diff --git a/widgets/nebula-videos/preview.png b/widgets/nebula-videos/preview.png new file mode 100644 index 00000000..c2d03a18 Binary files /dev/null and b/widgets/nebula-videos/preview.png differ