Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- dir='secret'
- function xmlgetnext(){
- local IFS='>'
- read -d '<' TAG VALUE
- }
- function rssget(){
- cp /dev/null "${dir}news.html"
- curl -s "$1" | while xmlgetnext ; do
- case "$TAG" in
- 'title')
- title="$VALUE"
- ;;
- 'link')
- link="$VALUE"
- ;;
- esac
- [[ $oldlink != "$link" ]] && echo "<a target='_blank' href='${link}'>${title}</a> <img src='IMG/tux.png' height='16' width='16'> " >> "${dir}news.html"
- oldlink="$link"
- done
- rssdata="$(sort -u "${dir}news.html" | tail -n+2)"
- echo "$rssdata"
- }
- linux_news="$(rssget 'https://www.linux.com/feeds/rss')"
- hacker_news="$(rssget 'https://news.ycombinator.com/rss')"
- printf '<!DOCTYPE html>
- <head>
- <style>
- a:link {
- text-decoration: none;
- color: black;
- }
- a:visited {
- text-decoration: none;
- color: black;
- }
- </style>
- <script type="text/javascript">
- window.addEventListener("wheel", function(e) {
- if (e.deltaY < 0) {
- document.getElementById("marq").setAttribute("scrolldelay", "10");
- }
- if (e.deltaY > 0) {
- document.getElementById("marq").setAttribute("scrolldelay", "55");
- }
- });
- </script>
- </head>
- <body>
- <marquee id="marq" scrolldelay="55" truespeed="1">%s%s</marquee>
- </body>' "${linux_news}" "${hacker_news}" > "${dir}news.html"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement