diff options
-rwxr-xr-x | pc | 33 |
1 files changed, 25 insertions, 8 deletions
@@ -3,12 +3,29 @@ curl -Ls "$@" | sed -n '/<item>/,$p' | sed -e '/^$/d' -e 's/^[ ]*//' | -awk -vFS='[<>]' ' - /<pubDate>/ { print "Date: " $3; } - /<title>/ { print "Subject: " $3; } - /<itunes:summary>/ { print "Summary: " $3; } - /<enclosure[^>]*>/ { print "Link: " $0; } - /<itunes:duration>/ { print "Duration: " $3; } - /<\/item>/ { print ""; } +awk -vFS='[<>]' -vOFS=' ' ' + /<pubDate>/ { date = $3 } + /<itunes:duration>/ { duration = $3 } + /<enclosure[^>]*>/ { file = $0 } + /<description>$/ { getline; summary = $0 } + /<description>..*/ { summary = $3 } + /<itunes:summary>$/ { getline; summary = $0 } + /<itunes:summary>..*/ { summary = $3 } + /<title>/ { title = $3 } + /<\/item>/ { + print "Title: " title + print "Duration: " duration + print "Date: " date + print "File: " file + print "Summary: " summary + print "" + date = "?" + duration = "?" + file = "?" + summary = "?" + title = "?" + } ' | -sed 's,<enclosure[^>]* url="\([^"]*\)".*,\1,' +sed -e 's,<description>,,' \ + -e 's,<enclosure[^>]* url="\([^"]*\)".*,\1,' \ + -e 's,<!\[CDATA\[\(.*\)\]\]>,\1,' |