<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>xingbuxing (xingbuxing)</title>
    <link>https://ruby-china.org/xingbuxing</link>
    <description/>
    <language>en-us</language>
    <item>
      <title>ruby 有机器学习或者自然语言处理相关的库吗？</title>
      <description>&lt;p&gt;如题，谢谢~ &lt;/p&gt;</description>
      <author>xingbuxing</author>
      <pubDate>Wed, 06 Feb 2013 16:39:19 +0800</pubDate>
      <link>https://ruby-china.org/topics/8627</link>
      <guid>https://ruby-china.org/topics/8627</guid>
    </item>
    <item>
      <title>mechanize 如何使用 cookie 登陆网站</title>
      <description>&lt;p&gt;1.我首先用 firefox 的 firebug 的 export cookies for this site 功能导出校内网站的 cookies 到一个文本文件。&lt;/p&gt;

&lt;p&gt;2.mechanize 有个 load_cookiestxt 的方法，好像是专门可以读入 firefox 导出的 cookies（我参考了这篇博文：&lt;a href="http://samsam.iteye.com/blog/474170" rel="nofollow" target="_blank"&gt;http://samsam.iteye.com/blog/474170&lt;/a&gt;）&lt;/p&gt;

&lt;p&gt;3.据此我写了如下的程序&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;#encoding: utf-8&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'mechanize'&lt;/span&gt;

&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Mechanize&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;  
&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cookie_jar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load_cookiestxt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'C:\Users\pc\Desktop\cookies.txt'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="ss"&gt;:/&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;www&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;renren&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;com&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但是 page 中返回的仍然是 renren 登陆前的页面，不会返回登陆后的页面。
我的目的是登陆上使用 mechanize 这个包用 cookies 登陆人人。本人小白，初学编程。。实在不知道怎么办，希望各位高手指导、&lt;/p&gt;</description>
      <author>xingbuxing</author>
      <pubDate>Mon, 26 Nov 2012 10:29:20 +0800</pubDate>
      <link>https://ruby-china.org/topics/7092</link>
      <guid>https://ruby-china.org/topics/7092</guid>
    </item>
    <item>
      <title>mechanize 如何登陆网站</title>
      <description>&lt;p&gt;想使用 ruby mechanize 登陆这个网站 &lt;a href="http://www.microbell.com/" rel="nofollow" target="_blank"&gt;http://www.microbell.com/&lt;/a&gt;。本人菜鸟，文档也看不大懂。。。求教各位大神应该怎么办。万分感谢。。继续去摸索&lt;/p&gt;</description>
      <author>xingbuxing</author>
      <pubDate>Tue, 30 Oct 2012 19:42:35 +0800</pubDate>
      <link>https://ruby-china.org/topics/6415</link>
      <guid>https://ruby-china.org/topics/6415</guid>
    </item>
    <item>
      <title>定时运行 ruby，rufus-scheduler 类使用问题</title>
      <description>&lt;p&gt;我想定时运行一段 ruby 程序，使用 rufus-scheduler 类，运行以下程序&lt;/p&gt;

&lt;p&gt;require 'rubygems'
require 'rufus/scheduler'&lt;/p&gt;

&lt;p&gt;scheduler = Rufus::Scheduler.start_new
scheduler.every '10s' do
       puts 'check blood pressure'
end&lt;/p&gt;

&lt;p&gt;为什么运行之后没有任何反应呢？并没有每十秒运行下程序啊。。
谢谢&lt;/p&gt;</description>
      <author>xingbuxing</author>
      <pubDate>Mon, 22 Oct 2012 11:15:19 +0800</pubDate>
      <link>https://ruby-china.org/topics/6226</link>
      <guid>https://ruby-china.org/topics/6226</guid>
    </item>
    <item>
      <title>使用 Mechanize 抓网页，出现 encoding error 问题</title>
      <description>&lt;p&gt;想把这个网页（&lt;a href="http://finance.sina.com.cn/oldnews/2012-03-09.html" rel="nofollow" target="_blank"&gt;http://finance.sina.com.cn/oldnews/2012-03-09.html&lt;/a&gt;）上的新闻的链接都抓下来，编写如下程序&lt;/p&gt;

&lt;p&gt;require 'mechanize'
agent = Mechanize.new
page = agent.get('&lt;a href="http://finance.sina.com.cn/oldnews/2012-03-09.html" rel="nofollow" target="_blank"&gt;http://finance.sina.com.cn/oldnews/2012-03-09.html&lt;/a&gt;') &lt;/p&gt;

&lt;p&gt;page.links.each do |link|
  puts link.text
end&lt;/p&gt;

&lt;p&gt;运行之后出现
encoding error: input conversion failed due to input error,bytes 0xE9 0x46 0xBB 0xF9&lt;/p&gt;

&lt;p&gt;程序会有输出，但是输出中只把这个页面中的一部分的链接抓了下来，只抓到这条新闻“2 月 CPI 同比上涨 3.2% PPI 与去年同月持平”，下面的就没有了。&lt;/p&gt;

&lt;p&gt;求问大神们如果解决这个问题，谢谢！&lt;/p&gt;</description>
      <author>xingbuxing</author>
      <pubDate>Fri, 19 Oct 2012 17:29:30 +0800</pubDate>
      <link>https://ruby-china.org/topics/6188</link>
      <guid>https://ruby-china.org/topics/6188</guid>
    </item>
  </channel>
</rss>
