Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Method for parsing courses #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ The returning object responds to the following methods
profile.languages # Array of languages

profile.certifications # Array of certifications

profile.courses #Array of instutions containing institution and courses in a hash

For current and past companies it also provides the details of the companies like company size, industry, address, etc

Expand Down
10 changes: 10 additions & 0 deletions lib/linkedin_scraper/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Profile
websites
languages
skills
courses
certifications
organizations
past_companies
Expand Down Expand Up @@ -172,6 +173,15 @@ def projects
end
end

def courses
@courses ||= @page.search('.background-courses .section-item').map do |institute|
c = {}
c[:name] = institute.at("h4").text rescue nil
c[:courses] = institute.at("ul.courses-listing").children.map { |course| course.text.strip if course.text } rescue nil
c
end
end

def to_json
require "json"
ATTRIBUTES.reduce({}){ |hash,attr| hash[attr.to_sym] = self.send(attr.to_sym);hash }.to_json
Expand Down