Skip to content

Instantly share code, notes, and snippets.

@ssig33
Created January 22, 2013 19:15
Show Gist options
  • Select an option

  • Save ssig33/4597455 to your computer and use it in GitHub Desktop.

Select an option

Save ssig33/4597455 to your computer and use it in GitHub Desktop.
require 'bundler'
require 'fileutils'
FileUtils.cd File.expand_path(File.dirname(__FILE__))
Bundler.require
require 'open-uri'
alice = Mechanize.new
page = alice.get "http://lantis-net.com/sasamisan/"
FileUtils.touch 'list' unless File.exist?('list')
list = open('list').read.split("\n")
page.root.xpath("//div[@class='pv_c']//a").select{|x| x.children.first['src'] =~ /r64/}.each{|link|
url = "http://lantis-net.com/sasamisan/#{link['href']}"
next if list.index url
asf = XmlSimple.xml_in(open(url).read)['Entry'].first['REF'].first['HREF']
system 'mimms', asf
list << url
}
open('list','w'){|x| x.puts list.sort.join("\n")}
source :rubygems
gem 'mechanize'
gem 'xml-simple', require: 'xmlsimple'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment