抓取链接的 LinkedIn 页面的公开个人资料
Linkedin-scraper is a gem for scraping public Linkedin profiles. Given the URL of the profile, it gets the name, country, title, area, current companies, past companies, organizations, skills, groups, etc
Install the gem from RubyGems:
gem install linkedin-scraperInclude the gem
require 'linkedin-scraper'Initialize a scraper instance
profile = Linkedin::Profile.new("http://www.linkedin.com/in/jeffweiner08")With a http web-proxy:
profile = Linkedin::Profile.new("http://www.linkedin.com/in/jeffweiner08", { proxy_ip: '127.0.0.1', proxy_port: '3128', username: 'user', password: 'pass' })The scraper can also get the details of each past and current companies. This will lead to multiple hits.
To enable this functionality, pass company_details=true in options. You can pass them along with proxy options
as well
profile = Linkedin::Profile.new("http://www.linkedin.com/in/jeffweiner08", { company_details: true })
profile = Linkedin::Profile.new("http://www.linkedin.com/in/jeffweiner08", { company_details: true, proxy_ip: '127.0.0.1', proxy_port: '3128', username: 'user', password: 'pass' })It's also possible to set number of seconds to wait for the connection to open.
Scraper will throw exception after given timeout. E. g. to set two seconds long timeout
pass open_timeout: 2 in options. Defaults to 60 seconds.
profile = Linkedin::Profile.new("http://www.linkedin.com/in/jeffweiner08", {open_timeout: 2 })The returning object responds to the following methods
…For current and past companies it also provides the details of the companies like company size, industry, address, etc The company details will only be scraped if you pass company_details=true. It is false by default.
…The gem also comes with a binary and can be used from the command line to get a json response of the scraped data. It takes the url as the first argument. If the last argument is true it will fetch the company details for each company.
linkedin-scraper http://www.linkedin.com/in/jeffweiner08 127.0.0.1 3128 username password
linkedin-scraper http://www.linkedin.com/in/jeffweiner08 127.0.0.1 3128 username password trueBug reports and pull requests are welcome on GitHub at https://github.com/yatish27/linkedin-scraper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
暂无开放 Issues,或尚未同步最近议题。