require 'nokogiri'
require 'open-uri'

class Thestudio
  include Cinch::Plugin

  match /(tstudio)$/, prefix: /^(\.)/
  match /(help tstudio)$/, method: :help, prefix: /^(\.)/

  def execute(m)
    page = Nokogiri::HTML(open('http://thestudio.kr/'))
    title = page.css('ul#navlist li p a')[31].text
    href = page.css('ul#navlist li p a')[31]['href']
    m.reply "#{title}: http://thestudio.kr#{href}"
  end

  def help(m)
    m.reply 'returns most recent thestudio.kr post'
  end

end

require 'nokogiri'
require 'open-uri'

class Thestudio
  include Cinch::Plugin

  match /(studio)$/, prefix: /^(\.)/
  match /(help studio)$/, method: :help, prefix: /^(\.)/

  def execute(m)
    page = Nokogiri::HTML(open('http://thestudio.kr/'))
    title = page.css('p.tt-post-title.tt-clear a')[rand(1..29)].text
    href = page.css('p.tt-post-title.tt-clear a')[rand(1..29)]['href']
    m.reply "#{title}: http://thestudio.kr#{href}"
  end

  def help(m)
    m.reply 'returns random recent thestudio.kr post'
  end

end

Change .tstudio => .studio. Now returns random recent post
Change .tstudio => .studio. Now returns random recent post
