Created
July 27, 2013 05:44
-
-
Save ohta-rh/6093906 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
encoding: utf-8 | |
# TODO ①URL解析 ②HTML取得 ③検索部分を抜き出す ④結果をparseする ⑤結果をcsvで表示 | |
require 'open-uri' | |
require 'csv' | |
url = ARGV[0] # URLを実行時引数から入力 | |
key_word = (ARGV[1]) # キワードの検索で使用する | |
html = open(url).read | |
# ここは使用するかビミョなので一旦コメントアウトする | |
# html = open(url, "r:binary").read.encode("utf-8", "euc-jp", invalid: :replace, undef: :replace) | |
key_word = html.scan(key_word) | |
keyword_times = key_word.count | |
puts key_word | |
puts keyword_times |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
スペースが気になる。