dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit c42ab4ba69cfe32034684d2a34fe2e8e881e5cdf
parent ebd1e134ba523def4aa40b026abb0e623503f1af
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Sun, 21 Apr 2024 19:54:31 +0200

linkhandler: add noecho.news integration

Diffstat:
Ascripts/article-noecho-news | 16++++++++++++++++
Mscripts/linkhandler | 8++++++++
2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/scripts/article-noecho-news b/scripts/article-noecho-news @@ -0,0 +1,16 @@ +#!/bin/sh +output="$(curl -sL 'https://www.noecho.news/api/edge/analyze-article' \ + -H 'content-type: application/json' \ + -H 'origin: https://www.noecho.news' \ + -H 'accept-language: en-US,en;q=0.6' \ + -H 'referer: https://www.noecho.news/' \ + --data-raw "{\"url\":\"$1\"}")" + +curl -sL 'https://www.noecho.news/api/edge/find-different-perspectives' \ + -H 'content-type: application/json' \ + -H 'accept-language: en-US,en;q=0.6' \ + -H 'origin: https://www.noecho.news' \ + -H 'referer: https://www.noecho.news/' \ + --data-raw "{\"originalArticle\":$output}" \ + | jq -r '.[] | (["# \(.title)", .url, "=> \(.why)"] | join("\n") + "\n")' \ + | LESS='' less -X diff --git a/scripts/linkhandler b/scripts/linkhandler @@ -200,6 +200,14 @@ sub menu { } }]; + push @$tableref, ['Noecho News', sub { + my ($link) = @_; + detach sub { + notify 'Finding different perspectives...', "$link"; + launch_in_terminal(qq(article-noecho-news "$link")); + } + }]; + # Choose an option my @options = map { $_->[0] } @$tableref; my $choice = choose(\@options);