antiX News Stand “applet”

Forum Forums General Tips and Tricks antiX News Stand “applet”

  • This topic has 1 reply, 1 voice, and was last updated Dec 3-4:22 pm by PPC.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #71518
    Member
    PPC

      I’ve been a long time user of “curl wttr.in” to see the weather in the terminal (I launch it from a toolbar icon).

      This weekend I found out about “curl getnews.tech” to see headlines from the News, all over the world. We can personalize, appending our country’s code to the site, followed by a dot, before “getnews.tech” (ex: “curl pt.getnews.tech” shows me Portuguese news)

      Script for a Small “applet” to show world news, in a yad window:

      #!/bin/bash
      ###Script to show news in a yad window:
      curl getnews.tech | sed -e '1,2d' | sed 's/getnews.tech/http:\/\/getnews.tech/g' > /tmp/news.txt
      #Remove number tags
      sed -r "s/\x1b\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]//g" < /tmp/news.txt > /tmp/news2.txt
      #Remove first and last characters from each line
      sed -i 's/.$//; s/^.//' /tmp/news2.txt
      #Remove first 2 lines
      sed -e '1,2d' < /tmp/news2.txt > /tmp/news.txt
      #display text, with clickable links
      yad  --title="antiX- News stand"  --center --width=650  --height=550 --button=" x " --text-info <  /tmp/news.txt --show-uri
      

      Edit: To have clickable links in the terminal (click them and select to open the link in the default browser- it works in, (once again, adapt “getnews.tech” to include your country’s code):
      curl getnews.tech | sed -e '1,2d' | sed 's/getnews.tech/http:\/\/getnews.tech/g'

      (I hope the forum does not mangle the code)

      enjoy
      P.

      • This topic was modified 1 year, 5 months ago by PPC.
      • This topic was modified 1 year, 5 months ago by PPC.
      • This topic was modified 1 year, 5 months ago by PPC.
      #72178
      Member
      PPC
        Helpful
        Up
        0
        ::

        Marcelocripe talked me into making a more evolved version of the script, one that can be configured to access news from any of the pre-configured contries in getnews.tech…
        At first launch, the script will show international news. click the button on the bottom, select the website that referes to the country you want to read the news, and click “Ok”. The main window should reload and show only news for that country.
        If all goes well, this script will come, out of the box in my Ft10 transformation pack (allowing antiX users to get the weather forecast and now, news, at the click of an icon):

        The script can be downloaded at https://gitlab.com/antix-contribs/contribs-goodies/-/blob/master/antix-newstand-international.sh
        (download it and make sure it’s executable, before running it.

        P.

        • This reply was modified 1 year, 5 months ago by PPC.
      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.