閱讀208 返回首頁    go 火車采集器


火車采集器v7版新浪評論采集插件

火車采集器v7版新浪評論采集插件

作者:小文 發布於:2012-5-15 20:41 Tuesday 分類:免費插件

這個插件是對多頁中的第一個頁麵進行了分析,獲取到分頁總數,然後生成了分頁讓采集器下載,涉及的代碼為

        public List<string> GetPagesUrl(int level, string pageurl, string html, string pagesStyle, string pagesCombine)
        {
            List<string> urls = new List<string>();
            //"show": 127}, https://comment5.news.sina.com.cn/page/info?format=js&jsvar=pagedata&channel=gn&newsid=1-1-24331859&group=0&page=1&list=all&sort=0

https://news.sina.com.cn/c/2012-04-26/061224331859.shtml


            if (level == 1 && pageurl.Contains("page=1&"))
            {
              string sign="show\": ";
              int pos = html.IndexOf(sign);
              if (pos > 0)
              {
                  int pos2 = html.IndexOf("}", pos);
                  if (pos2 > 0)
                  {
                      int count = int.Parse(html.Substring(pos + sign.Length, pos2 - pos - sign.Length));
                      count = (int)Math.Ceiling((double)count / 20);
                      for (int i = 2; i < count + 1; i++)
                      {
                          urls.Add(pageurl.Replace("page=1", "page=" + i.ToString()));
                      }
                  }
              }
            }
            return urls;
        }

 

  public bool UseGetPagesUrl
        {
            get { return true; }
        }

 

規則請在附件中下載

 點擊查看原圖點擊查看原圖

附件下載:
新浪評論.7z 4.19KB

標簽: 新浪

相關日誌:

火車采集器偽原創插件V9版

單條記錄下載文件名加自增ID

火車采集器二維碼識別插件,已增加V7版本

jin11顏色尺碼獲取插件

百度相關搜索插件V7版(最後更新2012.11.23)

« 字體“Comic Sans MS”不支持樣式“Regular”的解決辦法 | 58驗證碼識別(最後更新2016.5.26)»

評論:

安徽熱線
2012-06-25 02:42
該插件有個問題,就是當你使用了評論插件的C#插件的話,就無法采集新浪新聞的分頁內容了,如果不使用C#插件就可以正常采集到文章的分頁內容,忘進行一下修複,謝謝!

發表評論:

最後更新:2017-05-09 01:05:59

  上一篇:go 關於標簽組合功能的使用說明
  下一篇:go 登錄軟件時提示索引超出範圍,必須為為非負值並小於集合大小的問題