This project is a Python-based LinkedIn scraper that automates the process of searching for LinkedIn profiles, extracting relevant information, and integrating with the LinkedIn API to retrieve additional data. The scraper uses Selenium for web automation and requests for API integration.
- Chrome Driver: Ensure you have the Chrome driver installed and provide its path in
chrome_driver_path. - LinkedIn Credentials: Enter your LinkedIn email and password in
mailandpaswdrespectively. - LinkedIn API Access: Obtain an access token and cookies for API requests and replace the placeholders in the script.
- Python (>=3.6)
- Chrome WebDriver - Ensure the path is correctly set in the code.
- LinkedIn Account
- Selenium
-
Clone the repository:
-
Run the script:
browser_automation_script.ipynb linkedin_api_script,ipynb
- Chrome Driver Path: Set the path to your Chrome driver in
chrome_driver_path. - LinkedIn Credentials: Provide your LinkedIn email and password in
mailandpaswd. - Search Name: Set the name you want to search in
Search_name. - API Access: Replace the placeholders for access token and cookies with valid values.
The script will generate a CSV file named profile.csv containing the extracted LinkedIn profile information.
To use the LinkedIn API, make sure you have obtained the necessary access token and cookies. Replace the placeholders in the API integration section of the script.
LinkedIn API does not offer users information currently. They only offer API for sharing or posting contents and other marketing or lead generation.
The below code is being generated from postman
token = 'Enter the access token'
cookies = 'Enter the cookie that has been generated'
import requests
url = "https://api.linkedin.com/v2/userinfo"
payload = {}
headers = {
'Authorization': f'Bearer {token}',
'Cookie': f'{cookies}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)