xpath 参考
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text.RegularExpressions;
using System.Configuration; /// <summary>
////// </summary>
public static class SearchConst
{ public static readonly string ARG_CLIENT = "client"; public static readonly string ARG_WORD = "word"; public static readonly int DataColumnCount = ; public static readonly int ColumnOfUrl = ; public static readonly int ColumnOfTitle = ; public static readonly int ColumnOfInfo = ; public static readonly int ColumnOfAdUrl = ; public static readonly string FMT_Date = "yyyy/MM/dd"; public static readonly string FMT_TIME = "HH:mm:ss"; public static readonly string UserAgentPC = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0"; public static readonly string UserAgentMobile = "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25"; public static readonly string SearchKeyWordPlace = "#{q}"; public static readonly string DefaultEncode = "UTF-8"; public static readonly string AttributeHref = "href"; public static readonly string FILEEXT_ZIP = ".zip"; public static readonly string FILE_TXT = "source.txt"; public static readonly string FILE_KEY = "SavePath"; public static readonly string BATCH_PARALLES_KEY = "BatchParalles"; public static readonly string FLG_ENABLED = ""; public static readonly string CLIENT_MONITOR = "BJMOR"; public static readonly string MSG_E_PAGE_STYLE_CHANGE = "fff"; public static class Google
{ public static readonly string UserAgent = UserAgentPC; public static readonly string[] XPATH_ROOT = { "mbEnd", "mbEnd" };
public static readonly string[] XPATH_CITE = { "//div[@id='mbEnd']//ol/li//cite", "//div[@id='mbEnd']//ol/li//cite" }; //获取url
public static readonly string[] XPATH_H3 = { "//div[@id='mbEnd']//ol/li//h3", "//div[@id='mbEnd']//ol/li/h3" }; // //获取标题
public static readonly string[] XPATH_ADURL = { "//div[@id='mbEnd']//ol/li//h3//a[1]", "//div[@id='mbEnd']//ol/li/h3//a[1]" };
public static readonly string[] XPATH_INFO = { "//div[@id='mbEnd']//ol/li//div[@class='ac ads-creative']", "//div[@id='mbEnd']//ol/li//div[@class='ads-creative']" };
// top info
public static readonly string[] XPATH_ROOT_TOP = { "taw", "taw" };
public static readonly string[] XPATH_CITE_TOP = { "//div[@id='tads']//ol/li//cite", "//div[@id='tads']//ol/li//cite" };
public static readonly string[] XPATH_H3_TOP = { "//div[@id='tads']//ol/li//h3", "//div[@id='tads']//ol/li/h3" };
public static readonly string[] XPATH_ADURL_TOP = { "//div[@id='tads']//ol/li//h3//a[1]", "//div[@id='tads']//ol/li/h3//a[1]" };
public static readonly string[] XPATH_INFO_TOP = { "//div[@id='tads']//ol/li//div[@class='ac ads-creative']", "//div[@id='tads']//ol/li//div[@class='ads-creative']" };
//
public static readonly Regex RegexAdUrl = new Regex(@"adurl=(http[\S]*$)");
//
public static readonly string BAITAI_ID = "";
} public static class GoogleM
{
public static readonly string UserAgent = UserAgentMobile; //info
public static readonly string[] XPATH_ROOT = { "bottomads", "bottomads" };
public static readonly string[] XPATH_CITE = { "//div[@id='tadsb']/ol/li//cite", "//div[@id='tadsb']/ol/li//cite" };
public static readonly string[] XPATH_H3 = { "//div[@id='tadsb']/ol/li//h3", "//div[@id='tadsb']/ol/li//h3" };
public static readonly string[] XPATH_ADURL = { "//div[@id='tadsb']/ol/li//h3//a", "//div[@id='tadsb']/ol/li//h3//a" };
public static readonly string[] XPATH_INFO = { "//div[@id='tadsb']/ol/li//div[@class='ac ads-creative']", "//div[@id='tadsb']/ol/li//div[@class='ads-creative']" }; // top info
public static readonly string[] XPATH_ROOT_TOP = { "tads", "tads" };
public static readonly string[] XPATH_CITE_TOP = { "//div[@id='tads']/ol/li//cite", "//div[@id='tads']/ol/li//cite" };
public static readonly string[] XPATH_H3_TOP = { "//div[@id='tads']/ol/li//h3", "//div[@id='tads']/ol/li//h3" };
public static readonly string[] XPATH_ADURL_TOP = { "//div[@id='tads']/ol/li//h3//a", "//div[@id='tads']/ol/li//h3//a" };
public static readonly string[] XPATH_INFO_TOP = { "//div[@id='tads']/ol/li//div[@class='ac ads-creative']", "//div[@id='tads']/ol/li//div[@class='ads-creative']" };
//
public static readonly Regex RegexAdUrl = new Regex(@"adurl=(http[\S]*$)");
//
public static readonly string BAITAI_ID = "";
} public static class MSN
{
public static readonly string UserAgent = UserAgentPC;
//b_context/b_ad
public static readonly string[] XPATH_ROOT = { "sidebar", "b_context" };
public static readonly string[] XPATH_CITE = { "//div[@class='sb_adsNv2']//li//cite", "//ol[@id='b_context']//li[@class='b_ad']//li//cite" };
public static readonly string[] XPATH_H3 = { "//div[@class='sb_adsNv2']//li//h3", "//ol[@id='b_context']//li[@class='b_ad']//li//h2" };
public static readonly string[] XPATH_ADURL = { "//div[@class='sb_adsNv2']//li//a", "//ol[@id='b_context']//li[@class='b_ad']//li//a" };
public static readonly string[] XPATH_INFO = { "//div[@class='sb_adsNv2']//li//p", "//ol[@id='b_context']//li[@class='b_ad']//li//p" };
//b_results/b_ad
public static readonly string[] XPATH_ROOT_TOP = { "results_container", "b_results" };
public static readonly string[] XPATH_CITE_TOP = { "//div[@class='sb_adsWv2']//li//cite", "//ol[@id='b_results']//li[@class='b_ad']//li//cite" };
public static readonly string[] XPATH_H3_TOP = { "//div[@class='sb_adsWv2']//li//h3", "//ol[@id='b_results']//li[@class='b_ad']//li//h2" };
public static readonly string[] XPATH_ADURL_TOP = { "//div[@class='sb_adsWv2']//li//a", "//ol[@id='b_results']//li[@class='b_ad']//li//a" };
public static readonly string[] XPATH_INFO_TOP = { "//div[@class='sb_adsWv2']//li//p", "//ol[@id='b_results']//li[@class='b_ad']//li//p" };
//
public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)");
//
public static readonly string BAITAI_ID = "";
} public static class Yahoo
{
public static readonly string UserAgent = UserAgentPC; public static readonly string XPATH_ROOT = "sIn";
public static readonly string XPATH_CITE1 = "//div[@id='So3']/div[@class='bd']/div[@class='w']/div[@class='a cf']";
public static readonly string XPATH_H31 = "//div[@id='So3']/div[@class='bd']/div[@class='w']/h3";
public static readonly string XPATH_ADURL1 = "//div[@id='So3']/div[@class='bd']/div[@class='w']/h3/a";
public static readonly string XPATH_INFO1 = "//div[@id='So3']/div[@class='bd']/div[@class='w']/p";
//
public static readonly string XPATH_ROOT_TOP = "So1";
public static readonly string XPATH_CITE_TOP = "//div[@id='So1']/div[@class='bd']/div[@class='w']/div[@class='a cf']";
public static readonly string XPATH_H3_TOP = "//div[@id='So1']/div[@class='bd']/div[@class='w']/h3";
public static readonly string XPATH_ADURL_TOP = "//div[@id='So1']/div[@class='bd']/div[@class='w']/h3/a";
public static readonly string XPATH_INFO_TOP = "//div[@id='So1']/div[@class='bd']/div[@class='w']/p";
//
public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)");
public static readonly string NullUrl = ">";
//
public static readonly string BAITAI_ID = "";
} public static class Yahoo2
{
public static readonly string UserAgent = UserAgentPC; public static readonly string XPATH_ROOT_TOP = "contents";
public static readonly string XPATH_CITE_TOP = "//div[@id='contents']/div[@class='cWrap']/div[@class='listWrap cf']/ul/li/cite";
public static readonly string XPATH_H3_TOP = "//div[@id='contents']/div[@class='cWrap']/div[@class='listWrap cf']/ul/li/h2/a";
public static readonly string XPATH_ADURL_TOP = "//div[@id='contents']/div[@class='cWrap']/div[@class='listWrap cf']/ul/li/h2/a";
public static readonly string XPATH_INFO_TOP = "//div[@id='contents']/div[@class='cWrap']/div[@class='listWrap cf']/ul/li/p[@class='smr']";
//
public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)");
public static readonly string NullUrl = ">";
//
public static readonly string BAITAI_ID = "";
} public static class YahooM
{
public static readonly string UserAgent = UserAgentMobile; public static readonly string XPATH_ROOT = "contentsInner";
public static readonly string XPATH_CITE = "//div[@id='contentsInner']//aside[@class='So']/div[@class='bd']/ul/li/cite";
public static readonly string XPATH_H3 = "//div[@id='contentsInner']//aside[@class='So']/div[@class='bd']/ul/li/h3";
public static readonly string XPATH_ADURL = "//div[@id='contentsInner']//aside[@class='So']/div[@class='bd']/ul/li/h3/a";
public static readonly string XPATH_INFO = "//div[@id='contentsInner']//aside[@class='So']/div[@class='bd']/ul/li/p[@class='dtl']"; public static readonly string XPATH_ROOT_TOP = "contentsInner";
public static readonly string XPATH_CITE_TOP = "//div[@id='contentsInner']/aside[@class='So next-cmm']/div[@class='bd']/ul/li/cite";
public static readonly string XPATH_H3_TOP = "//div[@id='contentsInner']/aside[@class='So next-cmm']/div[@class='bd']/ul/li/h3";
public static readonly string XPATH_ADURL_TOP = "//div[@id='contentsInner']/aside[@class='So next-cmm']/div[@class='bd']/ul/li/h3/a";
public static readonly string XPATH_INFO_TOP = "//div[@id='contentsInner']/aside[@class='So next-cmm']/div[@class='bd']/ul/li/p[@class='dtl']";
//
public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)");
public static readonly string NullUrl = ">";
//
public static readonly string BAITAI_ID = "";
} public static class BaiDu { public static readonly string UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"; public static readonly string[] XPATH_ROOT = { "ec_im_container", "ec_im_container" }; //第一种情况 。
public static readonly string[] XPATH_CITE = { "//a/font[@size='-1' and @class]","//a/font[@size='-1' and @class]" }; //第一种情况
public static readonly string[] XPATH_H3 = { "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-is-main-url]", "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-is-main-url]" };//第一种情况
public static readonly string[] XPATH_ADURL = { "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-is-main-url]", "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-is-main-url]" };
public static readonly string[] XPATH_INFO = { "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-click]/font[1]", "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-click]/font[1]" };
// top info
public static readonly string[] XPATH_ROOT_TOP = { "content_left", "content_left" };
public static readonly string[] XPATH_CITE_TOP = { "//table[@data-click]/tbody/tr/td//a[not(@data-is-main-url) and not(contains(@href,'tool'))]/span", "//div[@class and @style]/div/div/a/span[1]|//div/table/tbody/tr/td[2]/div//a/span[1]" }; //前下后上
public static readonly string[] XPATH_H3_TOP = { "//table/tbody/tr/td/a[ @data-is-main-url]", "//div[@class and @style]/div/div/h3" }; //前下后上
public static readonly string[] XPATH_ADURL_TOP = { "//table/tbody/tr/td/a[ @data-is-main-url]", "//table/tbody/tr/td/a[ @data-is-main-url]" }; //前下后上
public static readonly string[] XPATH_INFO_TOP = { "//table[@data-click and @class]/tbody/tr[3]/td/a[not(./span)]|//table[@data-click and @class]/tbody/tr/td/table/tbody/tr/td/div/font/a", "//div[@class and @style]/div/div[not(./span)]/a|//div/table/tbody/tr/td/div/font/a[not(./span)]" }; //前
//
//public static readonly Regex RegexAdUrl = new Regex(@"http[\S]*$");
//
public static readonly string BAITAI_ID = "";
} public static class CnBing { public static readonly string UserAgent = UserAgentPC; public static readonly string[] XPATH_ROOT = { "b_context", "b_context" };
public static readonly string[] XPATH_CITE = { "//div[@class='sb_add sb_adTA']//cite", "//div[@class='sb_add sb_adTA']//cite" };
public static readonly string[] XPATH_H3 = { "//div[@class='sb_add sb_adTA']//h2/a", "//div[@class='sb_add sb_adTA']//h2/a" };//第一种情况
public static readonly string[] XPATH_ADURL = { "//div[@class='sb_add sb_adTA']//h2/a", "//div[@class='sb_add sb_adTA']//h2/a" };
public static readonly string[] XPATH_INFO = { "//div[@class='sb_add sb_adTA']//div[@class='b_caption']/p", "//div[@class='sb_add sb_adTA']//div[@class='b_caption']/p" };
// top info
public static readonly string[] XPATH_ROOT_TOP = { "gg", "gg" };
public static readonly string[] XPATH_CITE_TOP = { "", "" }; //前下后上
public static readonly string[] XPATH_H3_TOP = { "", "" }; //前下后上
public static readonly string[] XPATH_ADURL_TOP = { "", "" }; //前下后上
public static readonly string[] XPATH_INFO_TOP = { "", "" }; //前下部分广告后上
//
public static readonly Regex RegexAdUrl = new Regex(@"rturl=(http[\S]*$)");
//
public static readonly string BAITAI_ID = "";
} public static class HaoSou { public static readonly string UserAgent = UserAgentPC;
// 右边的广告
public static readonly string[] XPATH_ROOT = { "side", "side" }; //获取范围
public static readonly string[] XPATH_CITE = { "//ul[@id='rightbox']/li/p/cite[not(contains(text(),' http://e.360.cn'))]|//div[@id='m-spread-left']//cite", "//ul[@id='rightbox']/li/p/cite[not(contains(text(),' http://e.360.cn'))]|//div[@id='m-spread-left']//cite" }; //第一种情况
public static readonly string[] XPATH_H3 = { "//ul[@id='rightbox']/li/h3/a[not(contains(text(),'ss'))]|//div[@id='m-spread-left']//h3/a", "//ul[@id='rightbox']/li/h3/a[not(contains(text(),'ss'))]|//div[@id='m-spread-left']//h3/a" };//第一种情况
public static readonly string[] XPATH_ADURL = { "//ul[@id='rightbox']/li/h3/a[not(contains(text(),'ss'))]|//div[@id='m-spread-left']//h3/a", "//ul[@id='rightbox']/li/h3/a[not(contains(text(),'ss'))]|//div[@id='m-spread-left']//h3/a" };
public static readonly string[] XPATH_INFO = { "//ul[@id='e_idea_pp']/li//p|//ul[@id='rightbox']/li/p[not(contains(text(),'4000-360-360'))]", "//ul[@id='e_idea_pp']/li//p|//ul[@id='rightbox']/li/p[not(contains(text(),'4000-360-360'))]" };
// top info
public static readonly string[] XPATH_ROOT_TOP = {"ss", "sss" };
public static readonly string[] XPATH_CITE_TOP = { "", "" }; //前下后上
public static readonly string[] XPATH_H3_TOP = { "", "" }; //前下后上
public static readonly string[] XPATH_ADURL_TOP = { "", "" }; //前下后上
public static readonly string[] XPATH_INFO_TOP = { "", "" }; //前下部分广告后上
//
//public static readonly Regex RegexAdUrl = new Regex(@"http[\S]*$");
//
public static readonly string BAITAI_ID = "";
} public static class Sogou {
public static readonly string UserAgent = UserAgentPC;
//right 部分
public static readonly string[] XPATH_ROOT = { "right" };
public static readonly string[] XPATH_CITE = { "//div[@class='bizr_fb']" };//绿色的url
public static readonly string[] XPATH_H3 = { "//h3[@class='bizr_title']" };//#ad_leftresult_0 > h3:nth-child(1)
public static readonly string[] XPATH_ADURL = { "//h3[@class='bizr_title']/a" };//.h3的url
public static readonly string[] XPATH_INFO = { "//div[@class='bizr_ft']" };
//top 部分
public static readonly string[] XPATH_ROOT_TOP = { "promotion_adv_container" };//*[@id="promotion_adv_container"]/div/div
public static readonly string[] XPATH_CITE_TOP = { "//div[contains(@class,'biz_rb')and @id]/div//cite" };
public static readonly string[] XPATH_H3_TOP = { "//h3[@class='biz_title']" };
public static readonly string[] XPATH_ADURL_TOP = { "//h3[@class='biz_title']/a" };
public static readonly string[] XPATH_INFO_TOP = { "//div[@class='crown_info_box' or @class='biz_ft']|//div[contains(@id,'box_id')]/table" };// "" //
//public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)");
//
public static readonly string BAITAI_ID = "";
public static readonly string NullUrl = ">";
} }
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Text.RegularExpressions;using System.Configuration;
/// <summary>/// SearchHelper の概要の説明です/// </summary>public static class SearchConst{
public static readonly string ARG_CLIENT = "client";
public static readonly string ARG_WORD = "word";
public static readonly int DataColumnCount = 4;
public static readonly int ColumnOfUrl = 0;
public static readonly int ColumnOfTitle = 1;
public static readonly int ColumnOfInfo = 2;
public static readonly int ColumnOfAdUrl = 3;
public static readonly string FMT_Date = "yyyy/MM/dd";
public static readonly string FMT_TIME = "HH:mm:ss";
public static readonly string UserAgentPC = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0";
public static readonly string UserAgentMobile = "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25";
public static readonly string SearchKeyWordPlace = "#{q}";
public static readonly string DefaultEncode = "UTF-8";
public static readonly string AttributeHref = "href";
public static readonly string FILEEXT_ZIP = ".zip";
public static readonly string FILE_TXT = "source.txt";
public static readonly string FILE_KEY = "SavePath";
public static readonly string BATCH_PARALLES_KEY = "BatchParalles";
public static readonly string FLG_ENABLED = "1";
public static readonly string CLIENT_MONITOR = "BJMOR";
public static readonly string MSG_E_PAGE_STYLE_CHANGE = "スポンサーチェックの検索媒体レイアウト変更";
public static class Google {
public static readonly string UserAgent = UserAgentPC;
public static readonly string[] XPATH_ROOT = { "mbEnd", "mbEnd" }; public static readonly string[] XPATH_CITE = { "//div[@id='mbEnd']//ol/li//cite", "//div[@id='mbEnd']//ol/li//cite" }; //获取url public static readonly string[] XPATH_H3 = { "//div[@id='mbEnd']//ol/li//h3", "//div[@id='mbEnd']//ol/li/h3" }; // //获取标题 public static readonly string[] XPATH_ADURL = { "//div[@id='mbEnd']//ol/li//h3//a[1]", "//div[@id='mbEnd']//ol/li/h3//a[1]" }; public static readonly string[] XPATH_INFO = { "//div[@id='mbEnd']//ol/li//div[@class='ac ads-creative']", "//div[@id='mbEnd']//ol/li//div[@class='ads-creative']" }; // top info public static readonly string[] XPATH_ROOT_TOP = { "taw", "taw" }; public static readonly string[] XPATH_CITE_TOP = { "//div[@id='tads']//ol/li//cite", "//div[@id='tads']//ol/li//cite" }; public static readonly string[] XPATH_H3_TOP = { "//div[@id='tads']//ol/li//h3", "//div[@id='tads']//ol/li/h3" }; public static readonly string[] XPATH_ADURL_TOP = { "//div[@id='tads']//ol/li//h3//a[1]", "//div[@id='tads']//ol/li/h3//a[1]" }; public static readonly string[] XPATH_INFO_TOP = { "//div[@id='tads']//ol/li//div[@class='ac ads-creative']", "//div[@id='tads']//ol/li//div[@class='ads-creative']" }; // public static readonly Regex RegexAdUrl = new Regex(@"adurl=(http[\S]*$)"); // public static readonly string BAITAI_ID = "001"; }
public static class GoogleM { public static readonly string UserAgent = UserAgentMobile;
//info public static readonly string[] XPATH_ROOT = { "bottomads", "bottomads" }; public static readonly string[] XPATH_CITE = { "//div[@id='tadsb']/ol/li//cite", "//div[@id='tadsb']/ol/li//cite" }; public static readonly string[] XPATH_H3 = { "//div[@id='tadsb']/ol/li//h3", "//div[@id='tadsb']/ol/li//h3" }; public static readonly string[] XPATH_ADURL = { "//div[@id='tadsb']/ol/li//h3//a", "//div[@id='tadsb']/ol/li//h3//a" }; public static readonly string[] XPATH_INFO = { "//div[@id='tadsb']/ol/li//div[@class='ac ads-creative']", "//div[@id='tadsb']/ol/li//div[@class='ads-creative']" };
// top info public static readonly string[] XPATH_ROOT_TOP = { "tads", "tads" }; public static readonly string[] XPATH_CITE_TOP = { "//div[@id='tads']/ol/li//cite", "//div[@id='tads']/ol/li//cite" }; public static readonly string[] XPATH_H3_TOP = { "//div[@id='tads']/ol/li//h3", "//div[@id='tads']/ol/li//h3" }; public static readonly string[] XPATH_ADURL_TOP = { "//div[@id='tads']/ol/li//h3//a", "//div[@id='tads']/ol/li//h3//a" }; public static readonly string[] XPATH_INFO_TOP = { "//div[@id='tads']/ol/li//div[@class='ac ads-creative']", "//div[@id='tads']/ol/li//div[@class='ads-creative']" }; // public static readonly Regex RegexAdUrl = new Regex(@"adurl=(http[\S]*$)"); // public static readonly string BAITAI_ID = "005"; }
public static class MSN { public static readonly string UserAgent = UserAgentPC; //b_context/b_ad public static readonly string[] XPATH_ROOT = { "sidebar", "b_context" }; public static readonly string[] XPATH_CITE = { "//div[@class='sb_adsNv2']//li//cite", "//ol[@id='b_context']//li[@class='b_ad']//li//cite" }; public static readonly string[] XPATH_H3 = { "//div[@class='sb_adsNv2']//li//h3", "//ol[@id='b_context']//li[@class='b_ad']//li//h2" }; public static readonly string[] XPATH_ADURL = { "//div[@class='sb_adsNv2']//li//a", "//ol[@id='b_context']//li[@class='b_ad']//li//a" }; public static readonly string[] XPATH_INFO = { "//div[@class='sb_adsNv2']//li//p", "//ol[@id='b_context']//li[@class='b_ad']//li//p" }; //b_results/b_ad public static readonly string[] XPATH_ROOT_TOP = { "results_container", "b_results" }; public static readonly string[] XPATH_CITE_TOP = { "//div[@class='sb_adsWv2']//li//cite", "//ol[@id='b_results']//li[@class='b_ad']//li//cite" }; public static readonly string[] XPATH_H3_TOP = { "//div[@class='sb_adsWv2']//li//h3", "//ol[@id='b_results']//li[@class='b_ad']//li//h2" }; public static readonly string[] XPATH_ADURL_TOP = { "//div[@class='sb_adsWv2']//li//a", "//ol[@id='b_results']//li[@class='b_ad']//li//a" }; public static readonly string[] XPATH_INFO_TOP = { "//div[@class='sb_adsWv2']//li//p", "//ol[@id='b_results']//li[@class='b_ad']//li//p" }; // public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)"); // public static readonly string BAITAI_ID = "003"; }
public static class Yahoo { public static readonly string UserAgent = UserAgentPC;
public static readonly string XPATH_ROOT = "sIn"; public static readonly string XPATH_CITE1 = "//div[@id='So3']/div[@class='bd']/div[@class='w']/div[@class='a cf']"; public static readonly string XPATH_H31 = "//div[@id='So3']/div[@class='bd']/div[@class='w']/h3"; public static readonly string XPATH_ADURL1 = "//div[@id='So3']/div[@class='bd']/div[@class='w']/h3/a"; public static readonly string XPATH_INFO1 = "//div[@id='So3']/div[@class='bd']/div[@class='w']/p"; // public static readonly string XPATH_ROOT_TOP = "So1"; public static readonly string XPATH_CITE_TOP = "//div[@id='So1']/div[@class='bd']/div[@class='w']/div[@class='a cf']"; public static readonly string XPATH_H3_TOP = "//div[@id='So1']/div[@class='bd']/div[@class='w']/h3"; public static readonly string XPATH_ADURL_TOP = "//div[@id='So1']/div[@class='bd']/div[@class='w']/h3/a"; public static readonly string XPATH_INFO_TOP = "//div[@id='So1']/div[@class='bd']/div[@class='w']/p"; // public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)"); public static readonly string NullUrl = ">"; // public static readonly string BAITAI_ID = "002"; }
public static class Yahoo2 { public static readonly string UserAgent = UserAgentPC;
public static readonly string XPATH_ROOT_TOP = "contents"; public static readonly string XPATH_CITE_TOP = "//div[@id='contents']/div[@class='cWrap']/div[@class='listWrap cf']/ul/li/cite"; public static readonly string XPATH_H3_TOP = "//div[@id='contents']/div[@class='cWrap']/div[@class='listWrap cf']/ul/li/h2/a"; public static readonly string XPATH_ADURL_TOP = "//div[@id='contents']/div[@class='cWrap']/div[@class='listWrap cf']/ul/li/h2/a"; public static readonly string XPATH_INFO_TOP = "//div[@id='contents']/div[@class='cWrap']/div[@class='listWrap cf']/ul/li/p[@class='smr']"; // public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)"); public static readonly string NullUrl = ">"; // public static readonly string BAITAI_ID = "004"; }
public static class YahooM { public static readonly string UserAgent = UserAgentMobile;
public static readonly string XPATH_ROOT = "contentsInner"; public static readonly string XPATH_CITE = "//div[@id='contentsInner']//aside[@class='So']/div[@class='bd']/ul/li/cite"; public static readonly string XPATH_H3 = "//div[@id='contentsInner']//aside[@class='So']/div[@class='bd']/ul/li/h3"; public static readonly string XPATH_ADURL = "//div[@id='contentsInner']//aside[@class='So']/div[@class='bd']/ul/li/h3/a"; public static readonly string XPATH_INFO = "//div[@id='contentsInner']//aside[@class='So']/div[@class='bd']/ul/li/p[@class='dtl']";
public static readonly string XPATH_ROOT_TOP = "contentsInner"; public static readonly string XPATH_CITE_TOP = "//div[@id='contentsInner']/aside[@class='So next-cmm']/div[@class='bd']/ul/li/cite"; public static readonly string XPATH_H3_TOP = "//div[@id='contentsInner']/aside[@class='So next-cmm']/div[@class='bd']/ul/li/h3"; public static readonly string XPATH_ADURL_TOP = "//div[@id='contentsInner']/aside[@class='So next-cmm']/div[@class='bd']/ul/li/h3/a"; public static readonly string XPATH_INFO_TOP = "//div[@id='contentsInner']/aside[@class='So next-cmm']/div[@class='bd']/ul/li/p[@class='dtl']"; // public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)"); public static readonly string NullUrl = ">"; // public static readonly string BAITAI_ID = "006"; }
public static class BaiDu {
public static readonly string UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko";
public static readonly string[] XPATH_ROOT = { "ec_im_container", "ec_im_container" }; //第一种情况 好像就一种情况。 public static readonly string[] XPATH_CITE = { "//a/font[@size='-1' and @class]","//a/font[@size='-1' and @class]" }; //第一种情况 public static readonly string[] XPATH_H3 = { "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-is-main-url]", "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-is-main-url]" };//第一种情况 public static readonly string[] XPATH_ADURL = { "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-is-main-url]", "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-is-main-url]" }; public static readonly string[] XPATH_INFO = { "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-click]/font[1]", "//a[contains(@class,'EC_BL')and contains(@id,'dfs')and @data-click]/font[1]" }; // top info public static readonly string[] XPATH_ROOT_TOP = { "content_left", "content_left" }; public static readonly string[] XPATH_CITE_TOP = { "//table[@data-click]/tbody/tr/td//a[not(@data-is-main-url) and not(contains(@href,'tool'))]/span", "//div[@class and @style]/div/div/a/span[1]|//div/table/tbody/tr/td[2]/div//a/span[1]" }; //前下后上 public static readonly string[] XPATH_H3_TOP = { "//table/tbody/tr/td/a[ @data-is-main-url]", "//div[@class and @style]/div/div/h3" }; //前下后上 public static readonly string[] XPATH_ADURL_TOP = { "//table/tbody/tr/td/a[ @data-is-main-url]", "//table/tbody/tr/td/a[ @data-is-main-url]" }; //前下后上 public static readonly string[] XPATH_INFO_TOP = { "//table[@data-click and @class]/tbody/tr[3]/td/a[not(./span)]|//table[@data-click and @class]/tbody/tr/td/table/tbody/tr/td/div/font/a", "//div[@class and @style]/div/div[not(./span)]/a|//div/table/tbody/tr/td/div/font/a[not(./span)]" }; //前下部分广告后上 // //public static readonly Regex RegexAdUrl = new Regex(@"http[\S]*$"); // public static readonly string BAITAI_ID = "007"; }
public static class CnBing {
public static readonly string UserAgent = UserAgentPC;
public static readonly string[] XPATH_ROOT = { "b_context", "b_context" }; public static readonly string[] XPATH_CITE = { "//div[@class='sb_add sb_adTA']//cite", "//div[@class='sb_add sb_adTA']//cite" }; public static readonly string[] XPATH_H3 = { "//div[@class='sb_add sb_adTA']//h2/a", "//div[@class='sb_add sb_adTA']//h2/a" };//第一种情况 public static readonly string[] XPATH_ADURL = { "//div[@class='sb_add sb_adTA']//h2/a", "//div[@class='sb_add sb_adTA']//h2/a" }; public static readonly string[] XPATH_INFO = { "//div[@class='sb_add sb_adTA']//div[@class='b_caption']/p", "//div[@class='sb_add sb_adTA']//div[@class='b_caption']/p" }; // top info public static readonly string[] XPATH_ROOT_TOP = { "なし", "なし" }; public static readonly string[] XPATH_CITE_TOP = { "", "" }; //前下后上 public static readonly string[] XPATH_H3_TOP = { "", "" }; //前下后上 public static readonly string[] XPATH_ADURL_TOP = { "", "" }; //前下后上 public static readonly string[] XPATH_INFO_TOP = { "", "" }; //前下部分广告后上 // public static readonly Regex RegexAdUrl = new Regex(@"rturl=(http[\S]*$)"); // public static readonly string BAITAI_ID = "008"; }
public static class HaoSou {
public static readonly string UserAgent = UserAgentPC; // 右边的广告 public static readonly string[] XPATH_ROOT = { "side", "side" }; //获取范围 public static readonly string[] XPATH_CITE = { "//ul[@id='rightbox']/li/p/cite[not(contains(text(),' http://e.360.cn'))]|//div[@id='m-spread-left']//cite", "//ul[@id='rightbox']/li/p/cite[not(contains(text(),' http://e.360.cn'))]|//div[@id='m-spread-left']//cite" }; //第一种情况 public static readonly string[] XPATH_H3 = { "//ul[@id='rightbox']/li/h3/a[not(contains(text(),'好搜推广'))]|//div[@id='m-spread-left']//h3/a", "//ul[@id='rightbox']/li/h3/a[not(contains(text(),'好搜推广'))]|//div[@id='m-spread-left']//h3/a" };//第一种情况 public static readonly string[] XPATH_ADURL = { "//ul[@id='rightbox']/li/h3/a[not(contains(text(),'好搜推广'))]|//div[@id='m-spread-left']//h3/a", "//ul[@id='rightbox']/li/h3/a[not(contains(text(),'好搜推广'))]|//div[@id='m-spread-left']//h3/a" }; public static readonly string[] XPATH_INFO = { "//ul[@id='e_idea_pp']/li//p|//ul[@id='rightbox']/li/p[not(contains(text(),'4000-360-360'))]", "//ul[@id='e_idea_pp']/li//p|//ul[@id='rightbox']/li/p[not(contains(text(),'4000-360-360'))]" }; // top info public static readonly string[] XPATH_ROOT_TOP = {"なし", "なし" }; public static readonly string[] XPATH_CITE_TOP = { "", "" }; //前下后上 public static readonly string[] XPATH_H3_TOP = { "", "" }; //前下后上 public static readonly string[] XPATH_ADURL_TOP = { "", "" }; //前下后上 public static readonly string[] XPATH_INFO_TOP = { "", "" }; //前下部分广告后上 // //public static readonly Regex RegexAdUrl = new Regex(@"http[\S]*$"); // public static readonly string BAITAI_ID = "009"; }
public static class Sogou { public static readonly string UserAgent = UserAgentPC; //right 部分 public static readonly string[] XPATH_ROOT = { "right" }; public static readonly string[] XPATH_CITE = { "//div[@class='bizr_fb']" };//绿色的url public static readonly string[] XPATH_H3 = { "//h3[@class='bizr_title']" };//#ad_leftresult_0 > h3:nth-child(1) public static readonly string[] XPATH_ADURL = { "//h3[@class='bizr_title']/a" };//.h3的url public static readonly string[] XPATH_INFO = { "//div[@class='bizr_ft']" }; //top 部分 public static readonly string[] XPATH_ROOT_TOP = { "promotion_adv_container" };//*[@id="promotion_adv_container"]/div/div public static readonly string[] XPATH_CITE_TOP = { "//div[contains(@class,'biz_rb')and @id]/div//cite" }; public static readonly string[] XPATH_H3_TOP = { "//h3[@class='biz_title']" }; public static readonly string[] XPATH_ADURL_TOP = { "//h3[@class='biz_title']/a" }; public static readonly string[] XPATH_INFO_TOP = { "//div[@class='crown_info_box' or @class='biz_ft']|//div[contains(@id,'box_id')]/table" };// ""
// //public static readonly Regex RegexAdUrl = new Regex(@"\*\*(http[\S]*$)"); //0 public static readonly string BAITAI_ID = "010"; public static readonly string NullUrl = ">"; }
}
xpath 参考的更多相关文章
- 【转】XPath 示例
XPath 示例 其他版本 本主题回顾整个 XPath 参考中出现的语法示例. 所有示例均基于 XPath 语法的示例 XML 文件 (inventory.xml). 有关在测试文件中使用 X ...
- XPATH 带命名空间数据的读取
在XML中,很多情况下有命名空间,如果直接使用XPATH 读取是会读到空节点. 解决办法如下: InputStream is=loader.getResourceAsStream("com/ ...
- HtmlCleanner结合xpath用法(转载)
HtmlCleaner cleaner = new HtmlCleaner(); TagNode node = cleaner.clean(new URL("http://finance.s ...
- scrapy2_初窥Scrapy
递归知识:oop,xpath,jsp,items,pipline等专业网络知识,初级水平并不是很scrapy,可以从简单模块自己写. 初窥Scrapy Scrapy是一个为了爬取网站数据,提取结构性数 ...
- 较全的IT方面帮助文档
http://www.shouce.ren/post/d/id/108632 XSLT参考手册-新.CHMhttp://www.shouce.ren/post/d/id/108633 XSL-FO参考 ...
- selenium java 浏览器操作
环境搭建 selenium 2.53 selenium-java-2.53.0.jar selenium-java-2.53.0-srcs.jar 原代码包 拷贝的工程lib下,做build path ...
- JDOM 操作XML
http://www.cnblogs.com/hoojo/archive/2011/08/11/2134638.html 可扩展标记语言——eXtensible Markup Language 用户可 ...
- python爬虫 scrapy2_初窥Scrapy
sklearn实战-乳腺癌细胞数据挖掘 https://study.163.com/course/introduction.htm?courseId=1005269003&utm_campai ...
- [开发笔记]-Linq to xml学习笔记
最近需要用到操作xml文档的方法,学习了一下linq to xml,特此记录. 测试代码: class Program { //参考: LINQ to XML 编程基础 - luckdv - 博客园 ...
随机推荐
- QBus 关注并推送实时公交信息
后台服务器定时根据关注列表,查询最近车辆,发送邮件进行推送
- 基于ruby的watir自动化测试 笔记二
基于ruby的watir自动化测试 笔记一的补充版,新增加了些特殊的控件捕获方法.还在更新中.... attribute_value 获取当前控件的属性 Value = ie.link(:id=> ...
- MVC数据库数据分页显示
首先从数据库获取数据 using System; using System.Collections.Generic; using System.Linq; using System.Web; usin ...
- MVC3异常处理的方法
1.采用内置的HandleErrorAttribute对象,跳转到指定错误页 示例:http://www.cnblogs.com/TomXu/archive/2011/12/15/2285432.ht ...
- css浮动
一.浮动介绍 历史: 浮动属性产生之初是为了实现“文字环绕”的效果,让文字环绕图片在网页实现类似word中“图文混排”. 定位方式: 浮动让元素脱离正常流,向父容器的左边或右边移动直到碰到包含容器的边 ...
- Java成员的访问权限控制
Java中的访问权限控制包含两个部分: 类的访问权限控制 类成员的访问权限控制 对类来说,访问权限控制修饰符可以是public或者无修饰符(默认的包访问权限): 对于类成员来说,访问权限控制修饰符可以 ...
- Java Se: Logging 框架说明
Java Logging 用惯了log4j等日志工具,竟然不知Java还自带了个log工具.今天有空了就来了解一下. 先来看一个简单的例子: public class SystemTest { pri ...
- Windows系统安装Oracle 11g 数据库
一.下载 http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html以下两网址来源此官方下载页 ...
- nodejs学习资料
官方文档 阿里nodejs7天快速教程 从零开始nodejs系列文章 一个周末掌握IT前沿技术之node.js篇 nodejs中文api文档 nodejs中文api文档(0.12.2) node ...
- 常用的JavaScript模式
模式是解决或者避免一些问题的方案. 在JavaScript中,会用到一些常用的编码模式.下面就列出了一些常用的JavaScript编码模式,有的模式是为了解决特定的问题,有的则是帮助我们避免一些Jav ...