Exemple #1
0
from linkedin_api import Linkedin
import csv


# Authenticate using any Linkedin account credentials
api = Linkedin('*****@*****.**', 'yourpassword')

with open('list.csv', newline='', encoding='utf-8') as csvfile:
    spamreader = csv.reader(csvfile)
    resultsArray = []
    results = []
    for name, surname in spamreader:

        credentials = name + ' ' + surname
        print('Processing ' + credentials)
        results = api.search({'keywords': credentials}, 200)

        resultOne = results[0]['publicIdentifier']
        print(results[1]['publicIdentifier'])
        resultsArray.append(resultOne)

    with open('results.csv', "w", newline='') as resultfile:
        spamwriter = csv.writer(resultfile, delimiter=',', quoting=csv.QUOTE_MINIMAL)
        for result in resultsArray:
            print(result, "ress")
            spamwriter.writerow([credentials] + ['https://www.linkedin.com/in/' + result])
    resultfile.close()


csvfile.close()
Exemple #2
0
######### Don't touch anything below this line ###########

from linkedin_api import Linkedin
from linkedin_api.utils.helpers import get_id_from_urn
from base64 import b64decode
from csv import writer

api = Linkedin(user, b64decode(password).decode("utf8"))

params = {
    "filters": "List(resultType->GROUPS)",
    "keywords": keywords,
    "queryContext": "List(spellCorrectionEnabled->true)",
}

l_d_groups = api.search(params, limit)

l_d_groups_sorted = sorted(
    l_d_groups,
    key=lambda k: int(
        k["headline"]["text"].split(" members")[0].split(" ")[2].replace(",", "")
    ),
    reverse=True,
)

l_l_groups = [
    (
        f"{api.client.LINKEDIN_BASE_URL}/groups/{get_id_from_urn(i['trackingUrn'])}",
        i["title"]["text"],
        i["headline"]["text"].split(" members")[0].split(" ")[2].replace(",", ""),
    )