Class: Linkedin::Profile
- Inherits:
-
Object
- Object
- Linkedin::Profile
- Includes:
- GetRelated, ProxyManager
- Defined in:
- lib/linkedin.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#degree ⇒ Object
Get the number of hops out where profile appears.
-
#initialize(url, driver, curhops, proxylist, usedproxies, use_proxies_li) ⇒ Profile
constructor
A new instance of Profile.
-
#pic_path ⇒ Object
Download the profile picture.
-
#profile_url ⇒ Object
Similar to linkedin_url.
-
#related_people ⇒ Object
Gets “people also viewed list” form profile sidebar.
-
#timestamp ⇒ Object
Get the time the profile was scraped.
Methods included from GetRelated
#addPointsToProfile, #downloadRelated, #fullProfileList, #getList, #getRelatedProfiles, #relScore
Constructor Details
#initialize(url, driver, curhops, proxylist, usedproxies, use_proxies_li) ⇒ Profile
Returns a new instance of Profile.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/linkedin.rb', line 9 def initialize(url, driver, curhops, proxylist, usedproxies, use_proxies_li) @linkedin_url = url @curhops = curhops @proxylist = proxylist @usedproxies = usedproxies # Add attributes to list ATTRIBUTES.push( "related_people", "profile_url", "timestamp", "degree", "pic_path") # Get page @driver = driver @page = Nokogiri::HTML(getPage(url, @driver, nil, 5, use_proxies_li).page_source) sleep(10) end |
Class Method Details
.get_profile(url, driver, curhops, proxylist, usedproxies, use_proxies_li) ⇒ Object
30 31 32 33 34 |
# File 'lib/linkedin.rb', line 30 def self.get_profile(url, driver, curhops, proxylist, usedproxies, use_proxies_li) Linkedin::Profile.new(url, driver, curhops, proxylist, usedproxies, use_proxies_li) rescue => e puts e end |
Instance Method Details
#degree ⇒ Object
Get the number of hops out where profile appears
52 53 54 |
# File 'lib/linkedin.rb', line 52 def degree @degree ||= @curhops end |
#pic_path ⇒ Object
Download the profile picture
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/linkedin.rb', line 57 def pic_path if picture # Get path dir = "public/uploads/pictures/" full_path = dir+picture.split("/").last.chomp.strip # Get file `wget -P #{dir} #{picture}` if !File.file?(full_path) return full_path end end |
#profile_url ⇒ Object
Similar to linkedin_url
42 43 44 |
# File 'lib/linkedin.rb', line 42 def profile_url @profile_url ||= @linkedin_url end |
#related_people ⇒ Object
Gets “people also viewed list” form profile sidebar
37 38 39 |
# File 'lib/linkedin.rb', line 37 def ||= getList(@page) end |
#timestamp ⇒ Object
Get the time the profile was scraped
47 48 49 |
# File 'lib/linkedin.rb', line 47 def ||= Time.now end |