Last active
September 24, 2024 14:42
-
-
Save bascht/a80669400e856357590d to your computer and use it in GitHub Desktop.
Download all a RSS feed and wget all the links for your personal offline reading pleasure. :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# - encoding: utf-8 - | |
# | |
# E.g. with: pinget.rb https://feeds.pinboard.in/rss/secret:YOURSECRET/u:YOURUSERNAME/toread/ | |
require 'rss' | |
require 'open-uri' | |
require 'uri' | |
WGET = ['wget', | |
'--recursive', | |
'--level=1', | |
'--quiet', | |
'--page-requisites', | |
'--html-extension', | |
'--tries=5', | |
'--convert-links', | |
'--restrict-file-names=windows', | |
'--no-parent'] | |
open(ARGV[0]) do |rss| | |
feed = RSS::Parser.parse(rss) | |
puts "Title: #{feed.channel.title}" | |
feed.items.each do |item| | |
puts "Downloading [#{item.title}](#{item.link})" | |
system(*[WGET, item.link].flatten) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exactly what I was looking for! Thanks!