Skip to content

Instantly share code, notes, and snippets.

@jyootai
jyootai / mechanize.rb
Created November 6, 2014 14:59
Mechanize
require 'mechanize'
agent = Mechanize.new
url=" "
hash = {:name => ' ', :value => ' ', :path => '/', :domain => ' '}
cookie = Mechanize::Cookie.new(hash[:name], hash[:value])
cookie.domain = hash[:domain]
cookie.path = hash[:path]
agent.cookie_jar.add(URI.parse(url), cookie)
page = agent.get(" ")
pp page
@jyootai
jyootai / competition.rb
Last active August 29, 2015 14:08
A script to help you view events
# encoding: utf-8
require 'open-uri'
require 'nokogiri'
puts"======================"
puts "请输入要查询的日期并按回车结束:"
date = gets()
init_uri = "http://www.zhibo8.cc/"
doc = Nokogiri::HTML(open(init_uri))
today=Time.now.day
id = case date.to_i