Skip to content

Instantly share code, notes, and snippets.

@iurikura
Created January 8, 2017 07:00
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 iurikura/3f06830610a0511e5cef5f0d715d8085 to your computer and use it in GitHub Desktop.
Save iurikura/3f06830610a0511e5cef5f0d715d8085 to your computer and use it in GitHub Desktop.
# -- coding: utf-8
require 'nokogiri'
require 'anemone'
opts = {
depth_limit: 1
}
URL = "https://filmarks.com/users/<Username>" # Username を入れてください
Anemone.crawl(URL, opts) do |anemone|
anemone.focus_crawl do |page|
page.links.keep_if { |link|
link.to_s.match(/<Username>?page=d+/) # ここ、自信ないです
}
end
anemone.on_every_page do |page|
doc = Nokogiri::HTML.parse(page.body)
titles = doc.xpath("//html/body/div[3]/div[3]/div[1]/div/h3/a")
titles.each do |title|
p title.text
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment