简体   繁体   中英

Error in finding linkeding profile using python linkedin-scraper 2.6.0

I have a set of company's names and I want to find their profile on LinkedIn, to do this, I am using 'https://www.linkedin.com/company/'+company_name to test if it is the company profile and the linkedin-scraper, https://pypi.org/project/linkedin-scraper/ . The problem is that the program ends to run when the first valid link is found.

actions.login(driver, email, password) 
linkedin_info = []
for i in range(len(df['NAME'])):
    try:
        linkedin_info.append(Company('https://www.linkedin.com/company/'+df['NAME'[i],driver=driver),scrape=False)
        Company.scrape(close_on_complete=False)
        continue
    except:
        linkedin_info.append('info_not_found')
        continue

I'm using "try" because when no page is found we get an error. I also tried to use a list of valid LinkedIn links, but I can scrape only one link each time I run the code.

What might be the Issue?

I solved, the problem was that I was making a wrong use of the scrape function. I would have to do:

    linkedin_info[-1].scrape(close_on_complete=False)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM