Skip to content

Instantly share code, notes, and snippets.

@mubix
Created December 23, 2014 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mubix/b833671f8100f30899ac to your computer and use it in GitHub Desktop.
Save mubix/b833671f8100f30899ac to your computer and use it in GitHub Desktop.
Parse Site List for RSS
#!/usr/bin/env ruby
require 'feedbag'
require 'net/http'
source = Net::HTTP.get('ddosattackprotection.org', '/blog/cyber-security-blogs/')
body = source.split('"')
rss = []
body.each_with_index do |ob, index|
if ob =~ /.*href=/
begin
results = Feedbag.find(body[index+1])
results.each do |feed|
rss << feed
end
rescue RuntimeError
puts "Switching to HTTPS"
results = Feedbag.find(body[index+1]).gsub("­http","htt­ps")
results.each do |feed|
rss << feed
end
rescue
puts "Error found"
end
end
end
puts rss.uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment