Commit 6716798f authored by Tanguy's avatar Tanguy

Linkedin c'est le BAZAR

parent 162d3112
...@@ -20,16 +20,22 @@ SCOPES = ['https://www.googleapis.com/auth/spreadsheets'] ...@@ -20,16 +20,22 @@ SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
SPREADSHEET_ID = '1Rf_AmrKNkol--kKtWYJLHVYzL1ffTcpSjfuaSahRZx0' SPREADSHEET_ID = '1Rf_AmrKNkol--kKtWYJLHVYzL1ffTcpSjfuaSahRZx0'
creds = service_account.Credentials.from_service_account_file('token.json', scopes = SCOPES) creds = service_account.Credentials.from_service_account_file('token.json', scopes = SCOPES)
try: try:
service = build('sheets', 'v4', credentials=creds) service = build('sheets', 'v4', credentials=creds)
sheet = service.spreadsheets() sheet = service.spreadsheets()
body = { "values" : values } body = { "values" : values }
result = sheet.values().update( result = sheet.values().update(
spreadsheetId = SPREADSHEET_ID, spreadsheetId = SPREADSHEET_ID,
range = "A2:N" + str(s1), range = "A2:N" + str(s1),
valueInputOption = "USER_ENTERED", valueInputOption = "USER_ENTERED",
body = body body = body
).execute() ).execute()
print(result) print(result)
except HttpError as err: except HttpError as err:
print(err) print(err)
import requests
EMAIL = "luc.paluche@protonmail.com"
PASSWORD = "r3sp0DSI"
class LinkedinClient:
def cne():
return LinkedinClient("centrale-nantes-etudes")
def __init__(self, company):
self.company = company
self.session = requests.Session()
def initFetcher(self):
headers = {
"User-Agent" : "Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0",
"Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language" : "en-US,en;q=0.5",
"Accept-Encoding" : "gzip, deflate, br",
"Referer": "https://www.google.com",
"DNT" : "1",
"Connection" : "keep-alive",
"Upgrade-Insecure-Requests" : "1",
"Sec-Fetch-Dest" : "document",
"Sec-Fetch-Mode" : "navigate",
"Sec-Fetch-Site" : "cross-site",
"Sec-Fetch-User" : "?1"
}
self.session.headers = headers
page = self.session.get("https://fr.linkedin.com/company/" + self.company).text
print(page)
#https://www.linkedin.com/voyager/api/organization/updatesV2?companyIdOrUniversalName=1733557&count=10&moduleKey=ORGANIZATION_MEMBER_FEED_DESKTOP&numComments=0&numLikes=0&paginationToken=955123001-1642231846543-4da3900150c8782b9d457efae7b9a681&q=companyRelevanceFeed&start=3
#url = "https://www.linkedin.com/company/" + self.company + "/posts"
#params = {"feedview" : "all"}
url = "https://www.linkedin.com/voyager/api/organization/updatesV2"
params = {
"companyIdOrUniversalName" : 1733557,
"count" : 10,
"moduleKey" : "ORGANIZATION_MEMBER_FEED_DESKTOP",
"numComments" : 0,
"numLikes": 0,
"q":"companyRelevanceFeed",
"start" : 0
}
#print(self.session.get(url, params=params).text)
cne = LinkedinClient.cne()
cne.initFetcher()
#!/bin/bash
curl 'https://fr.linkedin.com/company/centrale-nantes-etudes' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: https://www.google.com/' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: document' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-Fetch-User: ?1' --compressed
#!/bin/bash
curl 'https://fr.linkedin.com/company/centrale-nantes-etudes' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0' -H 'Referer: https://www.google.com/' --compressed
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment