Giter VIP home page Giter VIP logo

nom's Introduction

nom

Feed me

nom is a terminal based RRS feed reader using Glow styled markdown to improve the reading experience and a simple TUI using Bubbletea.

  • Local sync and offline reading
  • Backend connections (miniflux, freshrss supported)
  • Vim style keybindings for navigation
  • Plenty more features such as mark read/unread, filtering and feed naming

Install

See releases for binaries. E.g.

$ curl -L https://github.com/guyfedwards/nom/releases/download/v2.1.4/nom_2.1.4_darwin_amd64.tar.gz | tar -xzvf -

Usage

$ nom # start TUI
$ nom list -n 20 # list feed items in $PAGER, optionally show more
$ nom add <feed_url> 
$ nom --feed <feed_url> # preview feed without adding to config

Config

Config lives by default in $XDG_CONFIG_HOME/nom/config.yml or $HOME/Library/Application Support/nom/config.yml on darwin.
You can customise the location of the config file with the --config-path flag.

Feeds

Feeds are added to the config file and have a url and name.

feeds:
  - url: https://dropbox.tech/feed
    # name will be prefixed to all entries in the list
    name: dropbox 
  - url: https://snyk.io/blog/feed

You can also add feeds with the add command:

$ nom add <url>

Feeds are editable within nom by pressing E to open the config in your $EDITOR or $NOMEDITOR. After editing feeds, you will need to then refresh with r.

Youtube feeds

To add youtube feeds you can go to a channel and run the following in the browser console to get the rss feed link:

console.log(`https://www.youtube.com/feeds/videos.xml?channel_id=${document.querySelector("link[rel='canonical']").href.split('/channel/').reverse()[0]}`)

Show read (default: false)

Show read items by default. (can be toggled with M)

showread: true

Auto read (default: false)

Automatically mark items as read on selection or navigation through items.

autoread: true

Theme

Theme allows some basic color overrides in the feed view and then setting a custom markdown render theme for the overall markdown view. theme.glamour can be one of "dark", "dracula", "light", "pink", "ascii" or "notty". See here for previews and more info. Colors can be hex or ASCII codes, they will be coerced depending on your terminal color settings.

theme: 
  glamour: dark
  titleColor: "62"
  selectedItemColor: "170"
  filterColor: "#555555"

Backends

As well as adding feeds directly, you can pull in feeds from another source. You can add multiple backends and the feeds will all be added.

backends:
  miniflux:
    host: http://myminiflux.foo
    api_key: jafksdljfladjfk
  freshrss:
    host: http://myfreshrss.bar
    user: admin
    password: muchstrong

Openers

By default links are opened in the browser, you can specify commands to open certain links based on a regex string.
regex can be any valid golang regex string, it will be matched against the feed item link.
cmd is run as a child command. The %s denotes the position of the link in the command.
takeover dictates if the command should takeover the tty from nom. E.g. for opening links in lynx or other TUI.

openers:
  - regex: "youtube"
    cmd: "mpv %s"
  - regex: ".*"
    cmd: "lynx %s"
    takeover: true

Store

nom uses sqlite as a store for feeds and metadata. It is stored next to the config in $XDG_CONFIG_HOME/nom/nom.db. This can be backed up like any file and will store articles, read state etc. It can also be deleted to start from scratch redownloading all articles and no state.

Filtering

Within the nom view, you can filter by title pressing the / character. Filters can be applied easily. Here's some examples:

  • f:my_feed feed:my_second_feed - matches my_feed and my_second_feed
  • feedname:"my feed - with spaces" - matches my feed - with spaces
  • feed:'my feed, with single quotes!' - matches my feed, with single quotes!
  • feed:my\ feed\ with\ escaped\ spaces! - matches my feed with escaped spaces!

More filters to be added soon!

Building and Running via Docker

Build nom image

docker build -t nom .

This embeds the local docker-config.yml file into the container and will be used by default.

Running the nom via docker

docker run --rm -it nom

Use the -v command line argument to mount a local config onto /app/docker-config.yml as desired.

Dev setup

You can use the backends-compose.yml to spin up a local instance of miniflux and freshrss if needed for development.

$ docker-compose -f backends-compose.yml up

Debug logging

You can enable logging to a file using the DEBUGNOM env var. Passing any path will cause log calls to write there e.g. DEBUGNOM=debug.log

nom's People

Contributors

adamsoderstrom avatar condensedmilk7 avatar guyfedwards avatar kanielrkirby avatar lsmoura avatar nemoden avatar realbaylen avatar rostamborn avatar stmuk avatar typicalam avatar williamla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nom's Issues

Add option to specify config file

Was testing this bug (#7) and found that nom would error out. Couldn't find config file at the specified location to restore functionality. On macOS, turns out it's created at ~/Library/Application\ Support/nom/config.yml

Suggestion to either add this note to the documentation or store this in the expected location for macOS.

Extending this a bit further, would be nice to have a --config where you can specify/override the default config file used. Might be nice for testing too! :) nice work btw!

Remove old feeds

Removing a feed from config.yml doesn't remove items from the store

Currently have to mark all existing as read to remove from UI

Ability to favourite articles

Option to favourite articles and not have them cleaned up/removed from the cache.

Needs to be easy to export urls/content

Add macro capability similar to newsboat

Say there is a youtube video I want to watch. In my config it is rendered in elinks then I go to it. I press my macro key which is the comma then a y to play the video in mpv with help from yt-dlp.

macro y set browser "i3 exec mpv" ; open-in-browser ; set browser "elinks %u"

If I want to open the video in my browser, I have the macro key + f:

macro f set browser "i3 exec firefox" ; open-in-browser ; set browser "elinks %u"

It is very extensible because I can map it exactly how I like. If I want to open it in any program, I just set a macro for it.

Add version flag

Hi, I just thought that it would be nice to check the current version with a simple command line flag like --version.

cannot get fresh rss to work at all.

I am running on windows and I have tried to set this up in %LOCALAPPDATA% but I don't know which fresh RSS API this is supposed to use and every option I try from the help just makes it show the help again. Can I get some guidance?

Missing LICENSE

I see you have no LICENSE file for this project. The default is copyright.

I would suggest releasing the code under the GPL-3.0-or-later or AGPL-3.0-or-later license so that others are encouraged to contribute changes back to your project.

Theming?

Is there a way to theme the colors? I'm not a fan of the purple.

Crashes when malformed date

Hello!

When trying to preview this feed: https://www.sinembargo.mx/feed nom crashes with a panic error

$ nom -v -f https://www.sinembargo.mx/feed
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa9c018]

goroutine 22 [running]:
github.com/guyfedwards/nom/v2/internal/rss.feedToRSS({{0x7fff14fd2ba8?, 0x7fff14fd2ba8?}, {0x0?, 0x10dc770?}}, 0xc0005722c0)
	github.com/guyfedwards/nom/v2/internal/rss/rss.go:76 +0x1d8
github.com/guyfedwards/nom/v2/internal/rss.Fetch({{0x7fff14fd2ba8?, 0x0?}, {0x0?, 0x0?}}, {0x0?, 0x0?})
	github.com/guyfedwards/nom/v2/internal/rss/rss.go:43 +0x267
github.com/guyfedwards/nom/v2/internal/commands.fetchFeed(0xc000032420, 0x0?, {{0x7fff14fd2ba8?, 0x0?}, {0x0?, 0x0?}}, {0x0?, 0x0?})
	github.com/guyfedwards/nom/v2/internal/commands/commands.go:372 +0xa5
created by github.com/guyfedwards/nom/v2/internal/commands.Commands.fetchAllFeeds in goroutine 1
	github.com/guyfedwards/nom/v2/internal/commands/commands.go:263 +0x138

I think is because the pubDate is malformed, example: <pubDate>Dom, 16 Jun 2024 00:05:38 +0000 2024-06-16 00:05:38</pubDate> and gofeed does not parse it so *it.PublishedParsed doesn't exist

Also i think it should just continue with either an empty date or just the origin pubDate like other rss tools do, maybe?

Thank you for this tool it's exactly what i've been looking for, i love that i can use custom openers, mpv for youtube, or reader to get complete articles when the rss has only a little extract. is brilliant! ๐Ÿ‘

Bug: incorrect view when going up using the up arrow key in an item

When entering in an item, going down using the arrow key down works, but not the arrow up. When using the arrow up, only the first line will refresh. If we went a few times up using up key and then arrow key down, the view refreshes to the correct one.

In the demo, we can also see some lines being duplicated when pressing the arrow key down

Demo:

demo2

Config refactor

Currently the file/defaults precedence is poor. Needs to be refactored to accept defaults and then be overridden by the fileconfig or flags without the need to manually check if it's in the file config and set

Better performance for previewing feeds

Following on fromhttps://github.com//pull/25#discussion_r1081093157

Ahmmm, the problem with that is the fact that we do fetchAllFeeds on any FindArticle which does another HTTP request per feed, which is completely unnecessary since we are getting the same information we already fetched in the current session.

Let's say we are previewing 2 feeds:

acme.com/rss.xml
example.com/rss.xml
On the startup, we do 2 HTTP calls to get those feeds' contents.

Once user navigates to one of the articles, we do FindArticle which calls fetchAllFeeds resulting in 2 unnecessary HTTP calls. The more the user views articles, the more calls we are making in vain.

The repercussions are not only that the interface is sluggish, but we are risking requesting some of the feeds too often and getting rate-limited.

Some options:

  • have previewed feeds cached like normal feeds from config
  • separate caching and fetching logic and only fetch once for preview

Refreshes are a bit buggy

It seems that 1, refreshes block the app completely until they're done (which can take up to ~5 seconds), and 2, if you refresh when in the filtered view, your list becomes completely empty.

For point 1, I think it should probably be possible to put the logic for refreshing inside a goroutine, and set an internal variable for "refreshing" or something similar, so that the app doesn't compeletely stop for several seconds.

For point 2, I think the Filter Function just needs to trigger again, but I'm not 100% sure on how to force that. We might just run ResetFilter() if nothing else, so that the user isn't greeted with a completely blank page just from running refresh.

nom got merged into nixpkgs

Hey, just wanted to inform you that nom just got merged into the nix package repository:

NixOS/nixpkgs#266742

Thought you might like to know that people are using it and didn't know how else to contact you.

Error on build: opts.ShowFeedNames undefined

Hi there, I was looking to create a quick docker for this but ran into issues using the Makefile when running build. this is on alpine with the latest version of go 1.19.4. Any ideas?

/nom # make build
go build -o nom cmd/nom/main.go
go: downloading github.com/jessevdk/go-flags v1.4.0
go: downloading github.com/charmbracelet/bubbles v0.14.0
go: downloading github.com/charmbracelet/bubbletea v0.23.1
go: downloading github.com/charmbracelet/lipgloss v0.6.0
go: downloading golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/JohannesKaufmann/html-to-markdown v1.3.6
go: downloading github.com/charmbracelet/glamour v0.5.0
go: downloading github.com/muesli/reflow v0.3.0
go: downloading github.com/sahilm/fuzzy v0.1.0
go: downloading github.com/containerd/console v1.0.3
go: downloading github.com/mattn/go-isatty v0.0.16
go: downloading github.com/mattn/go-localereader v0.0.1
go: downloading github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b
go: downloading github.com/muesli/cancelreader v0.2.2
go: downloading github.com/muesli/termenv v0.13.0
go: downloading github.com/mattn/go-runewidth v0.0.14
go: downloading golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab
go: downloading github.com/PuerkitoBio/goquery v1.8.0
go: downloading golang.org/x/net v0.0.0-20220909164309-bea034e7d591
go: downloading github.com/atotto/clipboard v0.1.4
go: downloading github.com/yuin/goldmark v1.4.14
go: downloading github.com/yuin/goldmark-emoji v1.0.1
go: downloading github.com/aymanbagabas/go-osc52 v1.0.3
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading github.com/andybalholm/cascadia v1.3.1
go: downloading github.com/alecthomas/chroma v0.10.0
go: downloading github.com/microcosm-cc/bluemonday v1.0.17
go: downloading github.com/olekukonko/tablewriter v0.0.5
go: downloading github.com/dlclark/regexp2 v1.4.0
go: downloading github.com/aymerick/douceur v0.2.0
go: downloading github.com/gorilla/css v1.0.0
# command-line-arguments
cmd/nom/main.go:26:73: opts.ShowFeedNames undefined (type Options has no field or method ShowFeedNames)
make: *** [Makefile:2: build] Error 2

Move project towards using `bubbles/key` for keybinds.

This would add some interoperability with features of bubbles/list and others that use this already, and makes setting up keybinds much more consistent. It shouldn't take too long, and would help address the PR for #61.

The main move would be creating three keybind keymaps, one for List View, one for Filter View (see #61), and one for the Viewport View, and transitioning the keymaps from raw strings to the keymap counterparts (e.g., case key.Matches(msg, ListKeyMap.Quit): instead of case "q", "ctrl+c", "etc.":)

Ideas for Favorite Improvements

It seems that the f key to favorite a post does not work if you are reading the post. This makes the interaction a bit awkward because if I exit, its marked as read, so then I need to search for it with the read filter on, then when I favorite it it dissapears. It would be great to do the following.

  1. Allow users to favorite from within a post
  2. Make the favorites view show unread or read posts by default instead of needing to explicitly filter with M first.

Feature Request: armv7 build for termux?

Hi,

I tried installing nom in termux for android but it wont install. any possibility of providing armv7 and armv8 binaries of nom for linux/termux?

Thank you!

in termux (android, arm64 binary): unexpected e-type: 2

in termux (Google Pixel 5a android, arm64 binary) error:
nom -f http://rss.cnn.com/rss/cnn_topstories.rss
error:
"/data/data/com/termux/files/usr/bin/nom" has unexpected e-type: 2

At the same time, in Win11 WSL everything is W-O-N-D-E-R-F-U-L!
I'm so glad to be able to replace a newsboat, the last version of which could be installed only via (hated by me) snap.
Thanks a lot, you're my hero!

I wish it worked with Android too, please!

[Feature]: prefix freshrss category

It should prefix the category of a feed from freshrss similar to how you can

feeds:
    # name will be prefixed to all entries in the list
    name: dropbox 
  - url: https://snyk.io/blog/feed

Filtering

Newsboat does a lot but I've not worked out how to show tagged/starred articles by category, only by feed... Would love that feature and the ability to sync with Tiny Tiny RSS...

Add searching by text in list, also by source, category.

Options:

  • foo narrows by title
  • foo category:allfoos narrows by title within category

No error output

I've been having trouble getting nom's "open in browser" to work. To be fair, I am doing something I think out of the ordinary, in that i'm trying to get it to launch lynx in terminal rather than a desktop app, but the bug I'm actually reporting is that when I hit 'o' in nom, it drops out of app, but just goes back to a blank command line without any error output, so I'm having trouble figuring out which part of the chain is going wrong, whether its nom missing something, myself missing something, or perhaps just a fat finger in some config I have somewhere.

Sort by Oldest First

I'm loving this simple tool! I was wondering if we can get an option to sort by oldest item first (publish date ascending).

Some feeds cause panic

Some feeds I've tested cause panic with this output:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xbc6941]

goroutine 9 [running]:
github.com/guyfedwards/nom/internal/rss.Fetch({0xc0003bb080, 0x20})
	/home/pt/go/pkg/mod/github.com/guyfedwards/[email protected]/internal/rss/main.go:80 +0x341
github.com/guyfedwards/nom/internal/commands.fetchFeed(0x0?, 0x0?, {0xc0003bb080, 0x20})
	/home/pt/go/pkg/mod/github.com/guyfedwards/[email protected]/internal/commands/main.go:149 +0x86
created by github.com/guyfedwards/nom/internal/commands.Commands.fetchAllFeeds
	/home/pt/go/pkg/mod/github.com/guyfedwards/[email protected]/internal/commands/main.go:112 +0x46f

The URLs that cause the same issues are the following:

One piece of information that might be useful is that they are all built with Eleventy and are hosted on Netlify. The URL pointing to the feed XML file is handled by Netlify's "redirect" function that is specified in netlify.toml file. I think they are also technically Atom feeds.

Option to hide read articles

I'm missing only two features from nom, one is a command-line option to hide read articles. The other is the "Open link in default browser" feature mentioned elsewhere.

API integrations

An essential feature of newsboat for me is FreshRSS syncing (using Google Reader API).

Miniflux support if possible, or a google reader api support.

Add ability to read from external sources.

Sources:

  • FreshRSS
  • Miniflux
  • Google reader

A couple of ideas

Hi,

I came across your program on r/commandline and really liked what I saw in the demo, so I decided to install and try it out.

Here's a small list of things I would like to see added, if possible:

  • A system of hints to follow links (similar to qutebrowser), maybe rebind forward to C-f and use f to bring up the hint menu? (mentioned in #8 )

  • A search option (keybind: /)

  • More powerful ways of organizing feeds: categories, subcategories, tags... (#4 mentioned categories, although I didn't see they mentioned in the help menu, nor in the documentation/readme)

  • Ability to download the complete article (already mentioned in #10), maybe take inspiration from other readers that already do this like newsboat? Maybe using something like https://txtify.it/ and its api?

Sadly quite a few feeds only display a really short 1 paragraph description of the content instead of the actual content itself.

  • Expanding on #9, maybe add the ability to set default programs for certain categories/tags, for example, if I open an article tagged "Video" or "Youtube" it automatically opens up mpv.

  • A way to (bulk)mark articles as (un)read along with the option to hide read articles/empty categories by default.

I'm quite new to github, so if you'd prefer me to comment on the other issues or create individual ones for each idea, feel free to tell me!

Implement custom help view

The help view has only three columns and is not well balanced in the list view, we should be able to create our own one copying the list implementation for more flexibility.

command not found

After installing nom through "go install", as shown in the README, running the command simply returns "zsh: command not found: nom"

Attempting to re-run "go install github.com/guyfedwards/nom/cmd/nom@latest" doesn't seem to do anything.

Read all

Add a shortcut for tagging everything as read

feat: edit config urls within TUI

One feature I really like about newsboat is when you press E your url config is opened in vim by default and you can edit it.

From reddit user b3zi

Should not require the config file in certain cases

When running nom for the first time (adding the first feed), it still requires the configuration file to exist, which is sort of absurd, because a user has no feeds configured at the moment.

Besides, when using nom for previewing a feed, the configuration file also doesn't seem to be needed, and yet nom keeps requiring it :)

add command creates duplicate entries in config.yaml

$ nom add http://feeds2.feedburner.com/patshaughnessy
$ cat config.yml
feeds:
    - url: http://feeds2.feedburner.com/patshaughnessy
$ nom add http://feeds2.feedburner.com/patshaughnessy
$ cat config.yml
feeds:
    - url: http://feeds2.feedburner.com/patshaughnessy
    - url: http://feeds2.feedburner.com/patshaughnessy

It should be easy to check whether the url is already in the list. Not sure if there are repercussions though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.