From 4ad4857061ae5cba5ba85dfe390ce72098429443 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Sun, 30 May 2021 13:30:13 -0400 Subject: [PATCH] tweet-cgi: convert to CGI script from tweet-grab --- tweet-cgi | 12 ++++++++++++ tweet-grab | 13 ------------- 2 files changed, 12 insertions(+), 13 deletions(-) create mode 100755 tweet-cgi delete mode 100755 tweet-grab diff --git a/tweet-cgi b/tweet-cgi new file mode 100755 index 0000000..d63f8f3 --- /dev/null +++ b/tweet-cgi @@ -0,0 +1,12 @@ +#!/usr/bin/env sh +# Grabs a tweet form a user and display it. Avoids using the twitter +# API by scrapping a nitter instance, which can easily be scraped, +# unlike the intentionally crippled twitter.com. Powers +# https://ishaan.bhojwani.org + +INSTANCE=${INSTANCE:-https://nitter.fdn.fr} +USER=${USER:-keshinko} + +printf "Content-type: text/plain\n\n" +curl -s "$INSTANCE/$USER" | grep tweet-content | head -n 1 \ + | sed -e 's/<[^>]*>//g' -e 's/^[ \t]*\(.*$\)/\1/' diff --git a/tweet-grab b/tweet-grab deleted file mode 100755 index b711bb1..0000000 --- a/tweet-grab +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env sh -# Grabs tweets and writes them to a file. Avoids using the twitter API by -# scrapping nitter.net (or any other nitter instance) which can easily be -# scraped, unlike the intentionally crippled twitter.com. See the output of -# this script at https://ishaan.bhojwani.org - -FILE=/root/tweets/index.html -LOGFILE=/root/tweets/cron.log -INSTANCE=https://nitter.fdn.fr - -curl $INSTANCE/keshinko | grep tweet-content | head -n 1 \ - | sed -e 's/<[^>]*>//g' -e 's/^[ \t]*\(.*$\)/\1/' > $FILE -date -R > $LOGFILE -- 2.39.2