├── .gitignore ├── Gemfile ├── Gemfile.lock └── cartoon.rb /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | .bundle/ 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # A sample Gemfile 2 | source "https://rubygems.org" 3 | 4 | # gem "rails" 5 | gem "nokogiri" 6 | gem "carrier-pigeon" 7 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | addressable (2.3.6) 5 | carrier-pigeon (0.7.0) 6 | addressable 7 | mini_portile (0.6.0) 8 | nokogiri (1.6.2.1) 9 | mini_portile (= 0.6.0) 10 | 11 | PLATFORMS 12 | ruby 13 | 14 | DEPENDENCIES 15 | carrier-pigeon 16 | nokogiri 17 | -------------------------------------------------------------------------------- /cartoon.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | require "open-uri" 3 | require "rubygems" 4 | require "nokogiri" 5 | require "carrier-pigeon" 6 | 7 | uri = (Time.now.utc).strftime("http://www.xnxx.com/cartoon_of_the_day/cartoons/%Y/%Y-%m-%d-cartoon.htm") 8 | 9 | # uri = "http://www.xnxx.com/cartoon_of_the_day/cartoons/2009/2009-11-05-cartoon.htm" 10 | 11 | # p uri 12 | 13 | charset = nil 14 | html = open(uri) do |f| 15 | charset = f.charset 16 | f.read 17 | end 18 | doc = Nokogiri::HTML.parse(html, nil, charset) 19 | 20 | p imgURI = doc.xpath('//img').attribute('src').value 21 | p imgAlt = doc.xpath('//img').attribute('alt').value 22 | 23 | 24 | pigeon = CarrierPigeon.new(:host => "192.168.220.32", 25 | :port => "36660", 26 | :nick => "xvieos", 27 | :channel => "#kmc-xvideos", 28 | :join => true) 29 | pigeon.message("#kmc-xvideos", "#{uri}") 30 | pigeon.message("#kmc-xvideos", "#{imgURI}") 31 | pigeon.message("#kmc-xvideos", "#{imgAlt}") if imgAlt != "" 32 | pigeon.die 33 | 34 | --------------------------------------------------------------------------------