module ZhSieve
Constants
- BASE_URL
- VERSION
- ZL_URI
Public Class Methods
crawl_answer(options)
click to toggle source
# File lib/zhSieve.rb, line 9 def self.crawl_answer(options) question_id = "#{options[:question_id]}" question_uri = "/question/#{question_id}" answer_id = "#{options[:answer_id]}" answer_uri = "#answer-#{answer_id}" search_uri = "#{BASE_URL}#{question_uri}#{answer_uri}" agent = Mechanize.new agent.user_agent = 'Chrome/53.0.2785.143' agent.max_history = 1 # Dir.chdir(File.dirname(__FILE__)) agent.cookie_jar.load_cookiestxt("./cookies.txt") search_page = agent.get("#{search_uri}") haha = HTMLPage.new(contents:search_page,question_id:question_id,answer_id:answer_id).answerMarkdown end
crawl_zl_article(options)
click to toggle source
# File lib/zhSieve.rb, line 28 def self.crawl_zl_article(options) article_id = "#{options[:article_id]}" search_uri = "#{ZL_URI}#{article_id}" agent = Mechanize.new agent.user_agent = 'Chrome/53.0.2785.143' agent.max_history = 1 # Dir.chdir(File.dirname(__FILE__)) agent.cookie_jar.load_cookiestxt("./cookies.txt") search_page = agent.get("#{search_uri}") haha = HTMLPage.new(contents:search_page,article_id:article_id).articleMarkdown end
crawl_zl_people(options)
click to toggle source
# File lib/zhSieve.rb, line 24 def self.crawl_zl_people(options) end