Skip to content

Instantly share code, notes, and snippets.

@hoskeri
Created March 4, 2011 04:50
Show Gist options
  • Select an option

  • Save hoskeri/854185 to your computer and use it in GitHub Desktop.

Select an option

Save hoskeri/854185 to your computer and use it in GitHub Desktop.
Script to scrape songs.pk
#!/usr/bin/ruby
require 'nokogiri'
require 'open-uri'
Nokogiri::HTML(open(ARGV[0])).css("a").map do |link|
link.attributes["href"].value
end.find_all do |link|
link.include? "song1.php?songid=" or link.include? "song.php?songid="
end.each do |link|
print "#{link}\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment