国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

各大招聘網(wǎng)站信息實時查詢?yōu)g覽

2019-11-14 16:05:31
字體:
供稿:網(wǎng)友

      最近聽得較多的跳槽、面試之類的,相信很多園友也開始蠢蠢欲動了,有的甚至早已經(jīng)開始了。最近我也在琢磨著換工作的事。說得俗套點,人在外面不就為了那么點工資么。現(xiàn)在找工作大部分都是通過在網(wǎng)上投簡歷,然后等電話 通知面試的。然,現(xiàn)在的招聘網(wǎng)站也是比較多。一個一個的在各大網(wǎng)站切換的流量招聘信息 實屬麻煩。之前看到過一篇博文。《找工作神器,提取各大網(wǎng)站有效的招聘信息(前程無憂、智聯(lián)招聘、獵聘網(wǎng))》感覺這想法挺好的。把各大網(wǎng)站信息集中起來瀏覽,第一省了來回切換,第二還不容易重復(fù)投簡歷。本想拿來用用的,無奈沒有提供源碼下載,且是客戶端版本。于是就只能自己動手,豐衣足食了~。(網(wǎng)站就是強大,可以大家一起分享●0●^_^)

     合并查詢本來就是為了簡單方便,所以也就沒有弄很復(fù)雜了,一個頁面搞定。如果同學(xué)們有什么好的想法,可以建議建議。

效果圖:

就一個簡單的關(guān)鍵字輸入框、工作地點的選擇和信息來源網(wǎng)站。

其實看上去很簡單,實現(xiàn)起來也很簡單。~~代碼不多,難度也很小。很多時候需要的技術(shù)不是很多,想法更重要。

不想往下看的可以直接用用 演示地址 ,同學(xué)們求工作給推薦推薦,上海 浦東 .net。 私密我,或Q我。

 

第一、分析url

進入招聘網(wǎng)站的時候url大串大串的,我們需要用的的就三個。搜索關(guān)鍵字、地址和頁碼。

智聯(lián)招聘:

http://sou.zhaopin.com/jobs/searchresult.ashx?jl=地址&kw=關(guān)鍵字&p=頁碼

jl=地址

kw=關(guān)鍵字

p=頁碼

然后地址的話 直接中文地址就ok了

獵聘網(wǎng):

http://www.liepin.com/zhaopin/?key=關(guān)鍵字&dqs=地址&curPage=頁碼

key=關(guān)鍵字

dqs=地址

curPage=頁碼

地址有一個對應(yīng)的編號

("北京", "010");
("上海", "020");
("廣州", "050020");...等等  也是在獵聘網(wǎng)選擇地址的地方右鍵 審查元素可以看到,如下:

前程無憂:

http://search.51job.com/jobsearch/search_result.php?jobarea=地址&keyWord=關(guān)鍵字&curr_page=頁碼

jobarea=地址 [和獵聘一樣的查找方法]

keyword=關(guān)鍵字

curr_page=頁碼

第二、用到了HtmlAgilityPack.DLL HTML解析組件

在之前我發(fā)過的 博客轉(zhuǎn)發(fā)小工具 有提過HtmlAgilityPack。這里再簡單的說說用法。

case ZhaopinType.獵聘網(wǎng):    var htmlWeb = new HtmlWeb();    htmlWeb.OverrideEncoding = Encoding.GetEncoding("UTF-8");    HtmlAgilityPack.HtmlDocument response = htmlWeb.Load(url);    #region MyRegion    var ulS = response.DocumentNode.SelectNodes("//*[@id='sojob']/div[2]/div/div/ul/li");    foreach (var item in ulS)    {        var xpath = item.XPath;        string titleName, infourl, company, city, date, salary, salary_em, source;        titleName = item.SelectSingleNode(xpath + "/a").Attributes["title"].Value;        infourl = item.SelectSingleNode(xpath + "/a").Attributes["href"].Value;        company = item.SelectSingleNode(xpath + "/a/dl/dt[@class='company']").InnerText;        city = item.SelectSingleNode(xpath + "/a/dl/dt[@class='city']/span").InnerText;        date = item.SelectSingleNode(xpath + "/a/dl/dt[@class='date']/span").InnerText;        salary = item.SelectSingleNode(xpath + "/a/dl/dt[@class='salary']/span").InnerText;        salary_em = item.SelectSingleNode(xpath + "/a/dl/dt[@class='salary']/em").InnerText;        source = "獵聘網(wǎng)";        zpInfoList.Add(            new ZhaopinInfo()            {                city = city,                company = company,                date = date,                info_url = infourl,                salary = salary,                salary_em = salary_em,                titleName = titleName,                source = source            });    }    #endregion    break;

1.設(shè)置訪問url頁面的編碼

 htmlWeb.OverrideEncoding = Encoding.GetEncoding("UTF-8");

設(shè)置編碼為UTF-8,具體看對應(yīng)頁面采用的編碼。

2.元素路徑下的元素集合

var ulS = response.DocumentNode.SelectNodes("http://*[@id='sojob']/div[2]/div/div/ul/li");

SelectNodes方法里面的這串字符串怎么來?

右鍵審查元素 Copy XPath 就ok了。不過如果js有動態(tài)修改document樹的話 那么這個路徑就不準了,需要自己微調(diào)下。

3、取標簽的屬性值 Attributes

如:取a標簽的title值。

titleName = item.SelectSingleNode(xpath + "/a").Attributes["title"].Value;

4.取標簽的中間的文本 InnerText

company = item.SelectSingleNode(xpath + "/a/dl/dt[@class='company']").InnerText;

5.過濾選擇特定的id 或 class

XPath 中 標簽名后面加上中括號 和@ 如: "/a/dl/dt[@class='company']"

第三、瀏覽器滾動條的onscroll事件

js獲取滾動條距離瀏覽器頂部,底部的高度,兼容ie和Firefox

取窗口可視范圍的高度[瀏覽器可見區(qū)域高度]

//取窗口可視范圍的高度[瀏覽器可見區(qū)域高度]        getClientHeight: function () {            var clientHeight = 0;            if (document.body.clientHeight && document.documentElement.clientHeight) {                var clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;            } else {                var clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;            }            return clientHeight;        }

取窗口滾動條高度[滾動條距離頂部的高度]

  getScrollTop: function () {            var scrollTop = 0;            if (document.documentElement && document.documentElement.scrollTop) {                scrollTop = document.documentElement.scrollTop;            } else if (document.body) {                scrollTop = document.body.scrollTop;            }            return scrollTop;        }

 

取文檔內(nèi)容實際高度

  getScrollHeight: function () {            return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);        }

 

滾動條距離底部的高度

getScrollbheight: function () { return this.getScrollHeight() - this.getScrollTop() - this.getClientHeight(); }

 

 取滾動條距離底部的高度,當滾動條到最底部的時候,通過Ajax異步請求后臺,加載下一頁數(shù)據(jù),這樣就可以免了翻頁的麻煩了。

 

ps:用jquery 更加簡潔(感謝@Samguist)

if ($(window).scrollTop() == $(document).height() - $(window).height()) {// ajax異步加載數(shù)據(jù)}

 

 

 

基本上就是這樣簡單,沒什么難度。記得有什么好工作通知一聲哦~^_^ ^_^   ***** 點擊本人求職信息*****

環(huán)境:vs2013   數(shù)據(jù)庫:無   插件:HtmlAgilityPack   演示地址  源碼下載  (源碼都下了 順手點個贊唄~)

下一篇:各大招聘網(wǎng)站信息實時查詢?yōu)g覽【二】

 


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 博乐市| 新泰市| 湘阴县| 宜兰市| 崇文区| 若尔盖县| 阿克陶县| 安图县| 麟游县| 青阳县| 江门市| 简阳市| 文水县| 辉南县| 昌图县| 大化| 新建县| 西青区| 大英县| 沁源县| 灌阳县| 松原市| 喀喇| 新巴尔虎右旗| 宁波市| 长泰县| 锦屏县| 色达县| 拉萨市| 巫山县| 连平县| 东兴市| 泗洪县| 易门县| 兰考县| 定结县| 绵阳市| 定结县| 随州市| 都昌县| 平顶山市|