Skip to content

Instantly share code, notes, and snippets.

@asad01304
Last active December 30, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asad01304/7887927 to your computer and use it in GitHub Desktop.
Save asad01304/7887927 to your computer and use it in GitHub Desktop.
{ vacancies: 1,
description:
[ 'Must be expertise in social media networking, search engine optimization and word press development.',
'PHP',
'Familiarity with the syntax and control structures of the given language.',
'Best practices for efficient and easier to maintain code.',
'Best practices for securing web applications.',
'Inserting, querying and managing data stored in databases or files.',
'Knowledge of PHP and database programming including:',
'The features and syntax of PHP data types, variables, constants and operators.',
'Knowledge of syntax of and how to employ expressions and functions.',
'Knowledge of how to apply control structures of PHP such as expressions, loops, conditional statements, and switch statements.',
'Session handling, PHP Configuration.',
'Understands web development markup languages HTML/XML; stylesheet languages CSS/XSL and JavaScript. Additionally, knowledge of the DOM, its objects
and their properties.',
'HTML',
'Familiarity of HTML syntax for multiple specifications, including HTML 5.',
'Knowledge of the semantic meaning of most HTML elements.',
'Familiarity with the semantic markup for display of lists, tabular data, forms, articles, etc.',
'Knowledge of markup used for layout such as dividers.',
'Knowledge at the level to be able to hand-code markup.',
'Including media and images.',
'XML (Optional)',
'Knowledge of XML syntax for markup and content.',
'Knowledge of how to use XML for the interchange of data',
'CSS',
'Specifying different CSS for various media, devices and displays.',
'Methods for including CSS inline, internal and external via linked style sheets.',
'Syntax of CSS declarations, properties and attributes.',
'CSS box model and methods for CSS positioning, absolute and relative.',
'Knowledge of properties and attributes to control the display.',
'***JavaScript',
'Knowledge of the operators, variables, data types, objects, properties and methods.',
'Familiarity with control structures such as objects, functions, conditional statements, arrays, loops and expressions.',
'Forms and regular expression validation and submitting data.',
'Knowledge of how to apply logical operators and conditional statements.',
'Event handling',
'Creating and controlling windows and dialogs.',
'Processes for troubleshooting and debugging',
'Familiarity with development and debugging tools for cross-browser issues.' ],
type: 'Full-time',
education: 'Graduate from any discipline',
experience: '2 to 3 year(s)' }
var VACANCIES = 'No. of Vacancies :',
DESCRIPTION = 'Job Description / Responsibility',
TYPE = 'Job Nature',
EDUCATION = 'Educational Requirements',
EXPERIENCE = "Experience Requirements",
REQUIREMENT = "Additional Job Requirements";
var args = process.argv, jobId = args[2] , catId = args[3];
var jsdom = require("jsdom");
jsdom.env({
url: "http://jobs.bdjobs.com/JobDetails.asp?ID=" + jobId + "&cid=" + catId,
scripts: ["http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"],
done: function (errors, window) {
console.log("http://jobs.bdjobs.com/JobDetails.asp?ID=" + jobId + "&cid=" + catId);
if(errors) {
console.log(errors);
return false;
}
var $ = window.$;
var $sections = {};
$('.BDJtabNormal').each(function(i, el){
var title = $(el).text().trim();
$sections[title] = $(el);
});
var scrapInfos = {};
if($sections[VACANCIES]){
scrapInfos.vacancies = processVacancies($sections[VACANCIES]);
}
if($sections[DESCRIPTION]){
scrapInfos.description = processDescription($sections[DESCRIPTION]);
}
if($sections[TYPE]){
scrapInfos.type = processType($sections[TYPE]);
}
if($sections[EDUCATION]){
scrapInfos.education = processEducation($sections[EDUCATION]);
}
if($sections[EXPERIENCE]){
scrapInfos.experience = processExprience($sections[EXPERIENCE]);
}
if($sections[REQUIREMENT]){
scrapInfos.requirement = processRuirement($sections[REQUIREMENT]);
}
/*Precessing functions*/
function processUL($el){
if(!$el.find('li').size()){
return $el.text().trim();
}
return $el.find('li').map(function(){ return $(this).text(); }).toArray() ;
}
function processVacancies($el){
return parseInt($el.parent().text().trim().replace(/[^\d]*/,''));
}
function processDescription($el){
return processUL($el.siblings('ul:eq(0)'));
}
function processType($el){
return $($el.sblings('br + br')[0].nextSibling ).text().trim() ;
}
function processEducation($el){
return processUL($el.next('ul'));
}
function processExprience($el){
return processUL($el.next('ul'));
}
function processRuirement($el){
console.log($el.html(), $el.next('ul').html());
}
console.log(scrapInfos);
}
});
@asad01304
Copy link
Author

node scraping-job-details.js 514428 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment