#!/bin/bash

# A very crude script that tries to find the rss feed of a page and then print
# the articles' titles from that feed

read -p "Please enter URL: " -r url


for rss in $(curl $url 2> /dev/null | sed -n 's/<link.*rel="alternate".*href="\(.*\)"[^>]*>/\1/p')
do
   echo "---------------------------------------------------------------------"
   echo "Printing titles from $url 's feed: $rss"
   echo "---------------------------------------------------------------------"
   curl $rss 2> /dev/null | sed -n 's/<title>\(.*\)<\/title>/\1/p'
done