Home > Enterprise >  LinkedIn Scraper: How do I convert a list of company names into LinkedIn URLs?
LinkedIn Scraper: How do I convert a list of company names into LinkedIn URLs?

Time:01-05

I built a LinkedIn web scraper using Python, Selenium, and BeautifulSoup which takes in a company's Linkedin URL and outputs information about the company e.g its competitors.

The problem I have is that my input is a list of company names. Is there a way where I can convert this list of company names into a list of LinkedIn URLs that I can feed into the web scraper? Thank you.

CodePudding user response:

I think that would work:

url = "https://www.linkedin.com/company/"   company_name

Lets say "https://www.linkedin.com/company/apple/"

CodePudding user response:

Use a list comprehension:

companies = ['companyA','companyB','companyC']

['https://www.linkedin.com/company/' c for c in companies]

Output:

['https://www.linkedin.com/company/companyA', 'https://www.linkedin.com/company/companyB', 'https://www.linkedin.com/company/companyC']

or iterate directly:

companies = ['companyA','companyB','companyC']

for company in companies:
    url = 'https://www.linkedin.com/company/' company
    #perform a request
    #scrape what you need
  •  Tags:  
  • Related