Real-Time query and browsing of information on various recruitment websites and Real-Time query of recruitment websites

Source: Internet
Author: User

Real-Time query and browsing of information on various recruitment websites and Real-Time query of recruitment websites

I have heard a lot about Job hopping and interviews recently. I believe many park friends are starting to get started, and some have even started. Recently I have been thinking about changing jobs. Well, it's cool to say that people are not paying for that amount out there. Currently, most job seekers submit resumes online, and then wait for a call to inform the interview. However, there are also many recruitment websites. One by one, it is troublesome to switch the traffic recruitment information on major websites. I have seen a blog post before. The idea of "looking for a job artifact, extracting effective recruitment information from various websites (carefree future, Zhaopin recruitment, and hunting Network)" is quite good. By aggregating the information of all major websites, you can switch back and forth in the first case, and you cannot submit your resume again. I wanted to use it, but I did not provide the source code for download, and it was the client version. So you can only do it yourself ~. (The website is powerful. You can share it with us. ● 0 ● ^_^)

The merging query was originally designed to be simple and convenient, so it was not complicated. It was done on a single page. If you have any good ideas, I suggest you.

:

A simple keyword input box, workplace selection, and information source website.

In fact, it looks very simple and easy to implement .~~ The code is not much, and the difficulty is very small. In many cases, there are not many technologies required, and the idea is more important.

If you don't want to look down, you can directly use the demo address. The students are recommended for work, such as Shanghai Pudong. net. Private me, or Q me.

 

First, analyze the url

When we enter the recruitment website, there are a large string of URLs. We need to use three. Search for keywords, addresses, and page numbers.

Zhaopin recruitment:

Http://sou.zhaopin.com/jobs/searchresult.ashx? Jl = address & kw = keyword & p = page number

Jl = address

Kw = keyword

P = page number

Then, the Chinese address is OK.

Hunting network:

Http://www.liepin.com/zhaopin? Key = keyword & dqs = address & curPage = page number

Key = keyword

Dqs = address

CurPage = page number

The address has a corresponding number.

("Beijing", "010 ");
("Shanghai", "020 ");
("Guangzhou", "050020");... and so on, you can right-click the review element at the address selected by the Referer website, as shown below:

Carefree future:

Http://search.51job.com/jobsearch/search_result.php? Jobarea = address & keyword = keyword & curr_page = page number

Jobarea = Address [the same search method as hunting]

Keyword = keyword

Curr_page = page number

Second, the HTML parsing component of HtmlAgilityPack. DLL is used.

I have mentioned HtmlAgilityPack in my blog forwarding tool before. Here is a simple example of usage.

Case ZhaopinType. hunting Network: var htmlWeb = new HtmlWeb (); htmlWeb. overrideEncoding = Encoding. getEncoding ("UTF-8"); HtmlAgilityPack. htmlDocument response = htmlWeb. load (url); # region MyRegion var ulS = response. documentNode. selectNodes ("// * [@ id = 'job']/div [2]/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 + "/"). attributes ["title"]. value; infourl = item. selectSingleNode (xpath + "/"). 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 = "hunting net"; 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. Set the url page Encoding

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

Set the encoding to UTF-8, depending on the corresponding page encoding.

2. element set under the element path

Var ulS = response. DocumentNode. SelectNodes ("// * [@ id = 'job']/div [2]/div/ul/li ");

How is this string in the SelectNodes method?

Right-click the review element Copy XPath and you will be OK. However, if js dynamically modifies the document tree, this path is not allowed and you need to fine-tune it yourself.

3. Attributes

For example, obtain the title value of tag.

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

4. The text InnerText in the middle of the tag

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

5. Filter and select a specific id or class

Brackets and @ such as: "/a/dl/dt [@ class = 'company']" are added to the tag name in XPath.

Third, the onscroll event of the browser scroll bar

Js obtains the height of the scroll bar from the top and bottom of the browser. It is compatible with ie and firefox.

Take the height of the visible window range [the height of the visible area of the browser]
// Take the height of the visible window range [visible area height of the browser] getClientHeight: function () {var clientHeight = 0; if (document. body. clientHeight & document.doc umentElement. clientHeight) {var clientHeight = (document. body. clientHeight <document.doc umentElement. clientHeight )? Document. body. clientHeight: document.doc umentElement. clientHeight;} else {var clientHeight = (document. body. clientHeight> document.doc umentElement. clientHeight )? Document. body. clientHeight: document.doc umentElement. clientHeight;} return clientHeight ;}
Take the height of the window scroll bar [the height of the scroll bar from the top]
  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;        }

 

Take the actual height of the Document Content
  getScrollHeight: function () {            return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);        }

 

Height of the scroll bar from the bottom
getScrollbheight: function () { return this.getScrollHeight() - this.getScrollTop() - this.getClientHeight(); }

 

Take the height of the scroll bar from the bottom. When the scroll bar is at the bottom, load the next page data through ajax asynchronous request background, which saves the trouble of page turning.

 

 

Basically, this is simple, and there is no difficulty.Remember to give me a notification about any good work ~ Pai_^

Environment: vs2013 Database: no plug-in: HtmlAgilityPack demo Address Source Code download (the source code has been successfully liked ~)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.