Rework YouTube list again
I'm moving to self-hosting this site and building it from my self-hosted code repo and CI, which won't have access to my FreeTube subscriptions when it builds. To get around this, I've moved to a script that will snapshot my local FreeTube subscriptions to a JSON file. I'll commit this file, and it can be used in the build on CI.
This commit is contained in:
parent
70a11752bf
commit
fffa8cc1da
4 changed files with 2075 additions and 11 deletions
|
|
@ -6,6 +6,7 @@
|
|||
"scripts": {
|
||||
"start": "npx @11ty/eleventy --serve",
|
||||
"createBlogPost": "bash create-blog-post.sh",
|
||||
"updateYT": "node updateYouTubeSubscriptions.mjs",
|
||||
"build": "npx @11ty/eleventy",
|
||||
"deploy": "npx netlify deploy --build",
|
||||
"deploy:prod": "npx netlify deploy --prod --build",
|
||||
|
|
|
|||
2052
src/_data/youtubeSubscriptions.json
Normal file
2052
src/_data/youtubeSubscriptions.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -6,16 +6,18 @@ tags: list
|
|||
templateEngineOverride: njk,md
|
||||
---
|
||||
|
||||
Most of the YouTube channels I subscribe to, categorized. This list is now automated! You can [learn how it's implemented](/blog/automating-my-youtube-channel-list/) and use the code yourself if you use FreeTube and have an Eleventy site.
|
||||
Most of the YouTube channels I subscribe to, categorized. This list is now automated! You can [learn how it was implemented](/blog/automating-my-youtube-channel-list/) and use the code yourself if you use FreeTube and have an Eleventy site.
|
||||
|
||||
I can't think of any particular trends or bubbling interests that contribute to the latest changes here. There aren't many new subscriptions, so most of the changes are a result of my pruning subscriptions I was no longer watching regularly.
|
||||
I've made another change to the way this page builds in moving to building on CI since that ☝️ blog post was written. It's still basically the same script, but instead of running during the build, I run it on-demand on my computer to snapshot the current state of my subscriptions and commit that data file to the repo. That file is then used by the build in CI to create this page.
|
||||
|
||||
Continuing to prune channels I don't watch regularly anymore. I've continued to unsubscribe from some tabletop channels since I'm not super engaged with that hobby right now. That's not the only category that's seen pruning, but it's the most prominent one.
|
||||
|
||||
## Key
|
||||
- 👀- Instant watch
|
||||
- 🤌- Online video virtuoso
|
||||
- 😌- Good for sleepytime (This doesn't mean the content is bad, just that it's relaxing.)
|
||||
|
||||
{% for category in freetubeCategories %}
|
||||
{% for category in youtubeSubscriptions %}
|
||||
## {{ category.name }}
|
||||
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Finds your FreeTube profiles.db and adds the channel objects divided by profile to global data
|
||||
// Access this anywhere via `freetubeCategories`, which will return an array of profile objects
|
||||
// Finds your FreeTube profiles.db and creates a JSON file in global data
|
||||
// Access this anywhere via `youtubeSubscrptions`, which will return an array of profile objects
|
||||
// Note: I refer to 'profiles' as 'categories' since that naming makes more sense given how I'm using them in this automation and on my site. In this documentation, a "category" is the same thing as a FreeTube "Profile."
|
||||
//
|
||||
// Category object structure:
|
||||
|
|
@ -21,10 +21,10 @@
|
|||
// This would be more generally useful if I parameterized some things like the tag categories, the config location, and some others, but I won't bother with that for now.
|
||||
// Maybe in a future revision… or maybe someone would like to submit that as a pull request!
|
||||
|
||||
const fs = require('fs');
|
||||
const fsPromises = fs.promises;
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
import fs from 'fs';
|
||||
import { promises as fsPromises } from 'fs';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
|
||||
const homeDir = os.homedir();
|
||||
const flatpakConfigPath = path.join(homeDir, '.var', 'app', 'io.freetubeapp.FreeTube', 'config', 'FreeTube');
|
||||
|
|
@ -35,7 +35,9 @@ const freetubeConfigLocationByOS = {
|
|||
win32: () => path.join(process.env.APPDATA, 'FreeTube'),
|
||||
};
|
||||
|
||||
module.exports = async function getSubscriptions() {
|
||||
const outputFile = path.join('src', '_data', 'youtubeSubscriptions.json');
|
||||
|
||||
async function updateSubscriptions() {
|
||||
const osName = os.platform();
|
||||
|
||||
if (!(osName in freetubeConfigLocationByOS)) {
|
||||
|
|
@ -121,5 +123,12 @@ module.exports = async function getSubscriptions() {
|
|||
category.subscriptions?.forEach(channel => channel.tags = subscriptionTags[channel.id])
|
||||
});
|
||||
|
||||
return sortedCategories;
|
||||
try {
|
||||
await fsPromises.writeFile(outputFile, JSON.stringify(sortedCategories, null, 2));
|
||||
console.log(`Subscriptions written to ${outputFile}`);
|
||||
} catch (error) {
|
||||
console.error(`Error writing to file: ${outputFile}`, error);
|
||||
}
|
||||
};
|
||||
|
||||
await updateSubscriptions();
|
||||
Loading…
Add table
Add a link
Reference in a new issue