# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 14
# self = https://watcher.sour.is/conv/ea5qacq
I see, @mckinley and @carsten, ta. My YouTube frontend is https://github.com/yt-dlp/yt-dlp in combination with https://newsboat.org/ and ybeuter, a TUI I wrote a long time ago to control downloading and opening queued videos.
@lyse I think we've talked about this before, but my front-end for every video host is MPV+yt-dlp with some MPV userscripts to improve the experience, called by Newsboat and my Web browser using ff2mpv.

Lately, I've been thinking about a wrapper script for MPV that tries to find a copy of the video on disk before it lets MPV use yt-dlp to stream it. This would be used in conjunction with another program that grabs a list of articles in Newsboat with a specific tag to filter videos from non-videos. Videos marked unread are queued for download with yt-dlp if there isn't already a local copy. Videos marked unread are deleted if there is a local copy. I think this could be done by interacting with Newsboat's database directly, but that isn't preferable.

How does ybeuter work? Is the source available?
@lyse I think we've talked about this before, but my front-end for every video host is MPV+yt-dlp with some MPV userscripts to improve the experience, called by Newsboat and my Web browser using ff2mpv.

Lately, I've been thinking about a wrapper script for MPV that tries to find a copy of the video on disk before it lets MPV use yt-dlp to stream it. This would be used in conjunction with another program that grabs a list of articles in Newsboat with a specific tag to filter videos from non-videos.

Videos marked unread are queued for download with yt-dlp if there isn't already a local copy. Videos marked read are deleted if there is a local copy. I think this could be done by interacting with Newsboat's database directly, but that isn't preferable.

How does ybeuter work? Is the source available?
@lyse I think we've talked about this before, but my front-end for every video host is MPV+yt-dlp with some MPV userscripts to improve the experience, called by Newsboat and my Web browser using ff2mpv.

Lately, I've been thinking about a wrapper script for MPV that tries to find a copy of the video on disk before it lets MPV use yt-dlp to stream it. This would be used in conjunction with another program that grabs a list of articles in Newsboat with a specific tag to filter videos from non-videos. Videos marked unread are queued for download with yt-dlp if there isn't already a local copy. Videos marked read are deleted if there is a local copy. I think this could be done by interacting with Newsboat's database directly, but that isn't preferable.

How does ybeuter work? Is the source available?
@mckinley Currently, I don't have the code online anywhere. It's suuuuper ugly and full of bugs. I might write a proper article on my video setup and workflow on the weekend.
@lyse I'd love to read it, man.
@mckinley Cool, I will see what I can do. :-)
@mckinley As promised, I finally just finished writing about my YouTube video consumption setup: https://lyse.isobeef.org/online-video-setup/ It took way longer than I thought.
@lyse Oh, nice! I'll check it out later, looks like an interesting read.
Awesome! Thank you for sharing. Intro tongue’s invidious everytime and download a lot from ÖRR when blocked in browser because NL not part of DACH
@lyse That was a very interesting read. It's fun to compare my setup to others.

I'll bet it's nice to have an offline copy of your videos. I've been thinking about a program that interfaces with Newsboat's database directly, getting the URLs of all unread articles with a specific tag.

When it runs, it would queue new videos for download with yt-dlp and delete any videos in the cache directory that I've marked read in Newsboat. From there, I'd just need a wrapper script to look for the video in the local cache before letting MPV stream it.

I was working on a prototype of this system a few weeks ago, but my implementation was just too hacky and I got sidetracked.

Also, what program are you using for the syntax highlighting in the article? I've been thinking of doing that for my site.
@mckinley Thank you, glad you liked it. Yes, having the videos locally enables me to watch them at any point in time. This was even more important in the past when my internet connection was not fast enough and everything took forever. Germany, a third world country when it comes to internet.

When starting ybeuter, it actually enqueues all non-downloaded entries automatically. So I just have to press s to start downloading. But at the moment I usually just dequeue all and reenqueue a few selected ones, because there are so many entries. :-/

I bet a program to get all URLs from unread articles out of _~/.newsboat/cache.db_ would be super simple. The only thing is, lately I do not want to watch all videos anymore, so this would leave me with a bunch of wasted traffic and disk space. So I don't mind the extra manual work. Sounds like you're not as picky or have a better set of channels to follow. :-) Launching MPV would also happen from within Newsboat, right? Otherwise marking articles as read becomes cumbersome I imagine, when the matching article needs to be found in the article list first. This program, that downloads all required videos found in Newsboat's SQLite database and removes them once marked read, that would be a cronjob? No user interaction required, did I get this right? Sounds like a cool idea.

For syntax highlighting I used Kate. Just selected the appropriate language and then exported to HTML. It works well, but requires a bit of clicking around in Kate and copying over into Vim. That's exactly what I have already done 15 years ago. For your use case, where you publish articles regularly, something scriptable like Pygments might be better suited, though._~
@lyse I already launch MPV directly from Newsboat. If you pass a URL at the command line, it will use stream it with yt-dlp.

After I update my feeds, I do a lot of manual filtering, marking videos I don't want to watch as read. This would stop the cache system from downloading or storing videos I don't want to watch.

> This program, that downloads all required videos found in Newsboat’s SQLite database and removes them once marked read, that would be a cronjob? No user interaction required, did I get this right?

It could definitely be a cron job, but I think I'd rather have it as a hotkey in my window manager. That way, I could run a video cache update after I'm done marking unwanted videos as read. Other than that, there would be no interaction required.
@mckinley Ah, now I see, Newsboat is in fact your control center. Thanks for the explanation. My plan was to make ybeuter also easily interfacable with other input sources. Like when getting a video suggestion by IRC, e-mail or whatever. But I actually never got that far. Atom feeds are just by large THE biggest ingestion source.