tomquirk / linkedin-api

👨‍💼Linkedin API for Python
MIT License
1.71k stars 401 forks source link

Working with nodejs #354

Closed tphuonglam82 closed 3 months ago

tphuonglam82 commented 8 months ago

How to use this API with Nodejs? Thanks all

tphuonglam82 commented 8 months ago

@tomquirk How to use this API with Nodejs? Thanks @tomquirk

halitsever commented 7 months ago

First of all i think this place is not for asking programming questions, you can go to stackoverflow for that kind of questions, because this not really "issue" or something.

Anyway let help you;

I'm using with node.js & flask server together like that:

Linkedin api back-end:

from flask import Flask
from linkedin_api import Linkedin

api = Linkedin('myuser@emaildomain.com', 'mysecretpass')
app = Flask(__name__)

@app.route("/")
def get_user():
    username = request.args.get('username', 'default_username')
    profile = api.get_profile_connections(username)
    return profile

Node.js client:

const axios = require('axios');
axios.get('http://127.0.0.1:5000/?username=halitsever')
  .then(function (response) {
    // handle success
    console.log(response.data);
  })
  .catch(function (error) {
    // handle error
    console.log(error);
  })
  .finally(function () {
    // always executed
  });

Another way for using linkedin api on node.js; you can use python script as child process but you should prevent multiple time logins because it can ban your linkedin account.

I hope that inspire you. @tphuonglam82

lamtrinhphuong commented 7 months ago

First of all i think this place is not for asking programming questions, you can go to stackoverflow for that kind of questions, because this not really "issue" or something.

Anyway let help you;

I'm using with node.js & flask server together like that:

Linkedin api back-end:

from flask import Flask
from linkedin_api import Linkedin

api = Linkedin('myuser@emaildomain.com', 'mysecretpass')
app = Flask(__name__)

@app.route("/")
def get_user():
    username = request.args.get('username', 'default_username')
    profile = api.get_profile_connections(username)
    return profile

Node.js client:

const axios = require('axios');
axios.get('http://127.0.0.1:5000/?username=halitsever')
  .then(function (response) {
    // handle success
    console.log(response.data);
  })
  .catch(function (error) {
    // handle error
    console.log(error);
  })
  .finally(function () {
    // always executed
  });

Another way for using linkedin api on node.js; you can use python script as child process but you should prevent multiple time logins because it can ban your linkedin account.

I hope that inspire you. @tphuonglam82

Thank you very much @halitsever