Skip to content

Instantly share code, notes, and snippets.

@iurikura
Last active January 9, 2017 12:45
Show Gist options
  • Save iurikura/216e8b25967dd6b2aa6ee3887020f7fe to your computer and use it in GitHub Desktop.
Save iurikura/216e8b25967dd6b2aa6ee3887020f7fe to your computer and use it in GitHub Desktop.
# -- coding: utf-8
require 'nokogiri'
require 'anemone'
opts = {
depth_limit: 2
}
URL = "https://filmarks.com/users/<username>" # Username を入れてください
Anemone.crawl(URL, opts) do |anemone|
# on_pages_like で書いてみた例。ちょっと出力がうまくいっていない。
anemone.on_pages_like(/https:\/\/filmarks.com\/users\/<username>\/clips/) do |page|  # clips は観たいリストのようなもの
page.doc.xpath('//html/body/div[3]/div[3]/div[1]').each do |node|
titlescores = node.xpath('./div/h3/a/text()|./div/div/div[3]/a/span/text()').to_s
p titlescores
end
end
end
@iurikura
Copy link
Author

iurikura commented Jan 9, 2017

結果に改行が入らない。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment