GithubHelp home page GithubHelp logo

shahzadokara / golinkedin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tamboto2000/golinkedin

0.0 0.0 0.0 153 KB

Golinkedin is a library written in pure golang for scraping Linkedin

License: MIT License

Go 100.00%

golinkedin's Introduction

Golinkedin

PkgGoDev GitHub GitHub go.mod Go version GitHub Workflow Status (branch)

Golinkedin is a library for scraping Linkedin. Unfortunately, auto login is impossible (probably...), so you need to retrieve Linkedin session cookies manually. As mentioned above, the purpose of this package is only for scraping, so there is no method for create, update, or delete data. Not all object is documented or present because Franklin Collin Tamboto, the original author, does not fully understand the purpose of some object returned by Linkedin internal API, and because the nature of Linkedin internal API that treat almost every object as optional, empty field or object will not be returned by Linkedin internal API, so some object or fields might be missing. Feel free to fork and contribute!

Current Features

  • Lookup Full Profile by Username
  • Profile Organizations Lookup
  • Profile Educations Lookup
  • Profile Certifications Lookup
  • Profile Honors Lookup
  • Profile Positions Lookup
  • Profile Interest Lookup
  • Profile Acitivity Lookup
  • Profile Recommendation Lookup
  • Profile Skill Lookup
  • Geolocation Search
  • Company Search
  • Group Search
  • People/Profile Search
  • Service Search
  • School Search

Upcoming Features

  • Profile Treasury Media Data
  • Profile Publications Lookup
  • Profile Volunteer Exeperiences Lookup
  • Profile Projects Lookup
  • Profile Patents Lookup
  • Profile Languages Data
  • Profile Courses Lookup
  • Profile Accomplishments

Installation

This package require go version 1.14 or above. Make sure you have go modules activated.

$ GO111MODULE=on go get github.com/tamboto2000/golinkedin

Full Profile Lookup Example

package main

import (
	"encoding/json"
	"os"

	"github.com/tamboto2000/golinkedin"
)

func main() {
	ln := golinkedin.New()
	ln.SetCookieStr(`your_linkedin_cookies`)

	profile, err := ln.ProfileByUsername("linkedin_username")
	if err != nil {
		panic(err.Error())
	}

	f, err := os.Create("profile.json")
	if err != nil {
		panic(err.Error())
	}

	if err := json.NewEncoder(f).Encode(profile); err != nil {
		panic(err.Error())
	}
}

Search Geo Example

package main

import (
	"encoding/json"
	"os"

	"github.com/tamboto2000/golinkedin"
)

func main() {
	ln := golinkedin.New()
	ln.SetCookieStr(`your_linkedin_cookies`)

	// search geo
	geoNode, err := searchGeo(ln, "USA")
	if err != nil {
		panic(err.Error())
	}

	f, err := os.Create("geo.json")
	if err != nil {
		panic(err.Error())
	}

	if err := json.NewEncoder(f).Encode(geoNode); err != nil {
		panic(err.Error())
	}
}

func searchGeo(ln *golinkedin.Linkedin, keyword string) (*golinkedin.GeoNode, error) {
	geoNode, err := ln.SearchGeo(keyword)
	if err != nil {
		panic(err.Error())
	}

	geos := make([]golinkedin.Geo, 0)
	for geoNode.Next() {
		geos = append(geos, geoNode.Elements...)
		if len(geos) >= 20 {
			break
		}
	}

	geoNode.Elements = geos

	return geoNode, nil
}

For now, every Node have SetLinkedin(), Error() error, and Next() bool method, except for ProfileNode

Todos

  • Write Tests
  • Add More Data and Features
  • Add CodeCove

License

MIT

golinkedin's People

Contributors

tamboto2000 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.