スポンサー広告---------
スポンサーサイト
上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。
未分類-2014-06-18
ぁーぅー。


#coding:utf-8

require "watir"
require "mechanize"
require "open-uri"
require "kconv"

$De = false
class BBS_2ch
attr_accessor :thre
def initialize hs
return if $De
@agent = Watir::Browser.new :ie
@agent.visible = hs[:visible]
@server = hs[:server]
end
def submit_th hs
server = hs[:server] || @server
agent = @agent
agent.goto server
__submit hs , agent.forms.last
end
def submit_res hs
ad = hs[:ad] || @ad
agent = @agent
agent.goto ad
# __submit hs , agent.form(:action => "../test/bbs.cgi?guid=ON")
__submit hs , agent
end
def __submit hs , f
sleep 1
subject = hs[:subject]
from = hs[:from]
mail = hs[:mail]
message = hs[:message]
f.text_field(:name, "subject").value = subject if not ( subject.nil? || subject.empty? )
f.text_field(:name, "FROM").value = from
f.text_field(:name, "mail").value = mail
f.text_field(:name, "MESSAGE").value = message
f.button(:name, "submit").click
begin ; f.button(:name, "submit").click ; rescue ; p $! end
p :__submit
end
def close
@agent.close
end

class Thre
attr_accessor :ad , :body , :me , :res
def initialize ad
@ad = ad
@me = Mechanize.new
@me.get ad
@res = [ ]
end
end

def analyze ad = @ad
@ad = ad
@thre = Thre.new ad
p ad
me = @thre.me
src = me.page.body
src.sub!("</dl>"," st = Struct.new( :num, :name, :mail, :message, )
@thre.res << st.new
src.scan(/(<dt>.*)/)[0..-2].map do | m |
m = m.first.toutf8
re = st.new
m =~ /<dt>(.*?) :/ ; re.num = $1
m =~ /<dd>(.*)/ ; re.message = $1
@thre.res << re
end

end
end

pat = [
"才能ある" , "天才すぎる" , "上手すぎ"
]

# $De = true

nya = BBS_2ch.new({
:visible => false ,
:server => "http://viper.2ch.net/news4vip/" ,
})

nya.analyze "url"
nya.thre.res[0..-2].reverse_each do | a |
if a.message =~ /jpg|png|gif/
puts a.num
puts a.message

nya.submit_res(
:ad => "url" ,
:message => ">>#{a.num}
#{pat.sample}" ,
)

sleep 50

end
end

=begin
nya.submit_res(
:ad => "url" ,
# :subject => "すれたて" ,
:from => "" ,
:mail => "" ,
:message => "あ" ,
)
=end
# exit


sleep 5
nya.close




# ---------------------------------------
   0..
Name
comment

hibana
上記広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書くことで広告を消せます。