linkedin_scraper
linkedin_scraper copied to clipboard
Scraping from a list of links
Hi, I am really stunned by the scraper you have built and really glad to be able to use it. I am facing an issue in scraping a list of people from an excel file that basically just has links.
The scraper starts scraping the first link, and then after scraping one link, it does manage to go to the other profile as I can view from chrome window, but it throws an exception and is unable to scrape further, giving me the data that was scraped for only one person in the beginning.
I would really appreciate your help in this, attaching my code here.
from linkedin_scraper import Person, actions
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
#from selenium.webdriver.chrome.service import Service
import pandas as pd
import openpyxl
chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(executable_path='C:\chromedriver.exe')
driver.set_window_size(1920, 1080)
email = "Email"
password = "password"
actions.login(driver, email, password) # if email and password isnt given, it'll prompt in terminal
dataframe1 = pd.read_excel('People.xlsx')
links = list(dataframe1['PeopleLinks'])
ExtractedList = []
for i in links:
person = Person(i, driver=driver, scrape=False)
person.scrape(close_on_complete=False)
ExtractedList.append(person)
for j in ExtractedList:
print(j)
What's the error that you get?
What's the error that you get?
Hey there!
What's the error that you get?
Hey there!  op = webdriver.ChromeOptions() driver = webdriver.Chrome(service=ser, options=op)
email = "[email protected]" password = "XXXXXXXXXXX" actions.login(driver, email, password) # if email and password isnt given, it'll prompt in terminal
dataframe1 = pd.read_csv("company_Linkedin_upload.csv') links = list(dataframe1['linkedin url'])
ExtractedList = []
for i in links: company = Company(i, driver=driver, scrape=False, get_employees=False) company.scrape(close_on_complete=False) ExtractedList.append(company) print(company)
for j in ExtractedList: print(j)`