Skip to content

Instantly share code, notes, and snippets.

@iurikura

iurikura/sample4.rb

Created Jan 8, 2017
Embed
What would you like to do?
# -- 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