-
Notifications
You must be signed in to change notification settings - Fork 0
/
sagashite-kun.rb
53 lines (40 loc) · 1.18 KB
/
sagashite-kun.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require 'bundler/setup'
require 'capybara-webkit'
require 'nokogiri'
require 'open-uri'
require 'kconv'
title = ARGV[0].to_s
def hulu(title)
url = "http://www.hulu.jp/search?q=" + title
driver = Capybara::Webkit::Driver.new 'app'
driver.visit url
node = driver.find_css('.promo-title-link')[0]
if node
p node.text + "は Hulu にあるよ。"
else
p title + "は Hulu にはないみたいだよ。"
end
end
def tsutaya(title)
url = "http://www.discas.net/netdvd/vod/searchVod.do?i=2&df=&k=" + URI.encode(title.tosjis)
doc = Nokogiri::HTML.parse(open(url).read.toutf8, nil, 'UTF-8')
node = doc.css('.tblColType01 tbody tr th a')
if node.empty?
p title + "は TSUTAYA TV にはないみたいだよ。"
else
p title + "は TSUTAYA TV にあるよ。"
end
end
def sky(title)
url = "http://vod.skyperfectv.co.jp/program_search.php?GENRE=&CHANNEL=&SUBMIT=%E6%A4%9C%E7%B4%A2&KEYWORD=" + URI.encode(title)
doc = Nokogiri::HTML(open(url))
node = doc.css('.number')
if node.empty?
p title + "は スカパー にはないみたいだよ。"
else
p title + "は スカパー にあるよ。"
end
end
hulu(title)
tsutaya(title)
sky(title)