Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
watch anime count in animetick.net
require "pp"
require "open-uri"
require "nokogiri"
@userid = "Coro365"
@crawl_page_number = 26
@animetick_subscribes = Array.new
def animetick_crawl(page_number)
url = "http://animetick.net/users/#{@userid}?page=#{page_number}"
begin
atick = Nokogiri::HTML.parse(open(url),nil,"utf-8")
rescue Exception => e
puts "#{e.message} #{url}"
end
atick.xpath("//li[@class='animation']").each do |i|
imgurl = i.xpath("div[@class='icon']/img").attribute("src").value
title = i.xpath("div[@class='detail']").attribute("title").value
tid = imgurl.slice(6..9).delete("_")
title.slice!(/\(第[0-9]*?クール\)/)
@animetick_subscribes.push([title, tid])
end
end
@crawl_page_number.times do |i|
animetick_crawl(i)
end
pp @animetick_subscribes.uniq!
puts ""
puts "Watched #{@animetick_subscribes.size} animes!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.