Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'data" #4

Closed
Shraknard opened this issue Feb 26, 2021 · 2 comments
Closed

KeyError: 'data" #4

Shraknard opened this issue Feb 26, 2021 · 2 comments

Comments

@Shraknard
Copy link

Hello,

I have an error while trying to scrap Linkedn. it is able to get the list of companies but when trying to get the employees, it fail at some point. I tried this on a basic Ubuntu with python3.
Thanks for the script anyway :)

Here is the command :
python3 socialpwned.py --credentials creds.json --output out.txt --linkedin --search-companies "MyCompany" --employees --pwndb

And here is the output :

Traceback (most recent call last):
  File "socialpwned.py", line 51, in <module>
    run(args)
  File "SocialPwned/core/main.py", line 214, in run
    results.extend(linkedinParameters(args,in_email,in_password))
  File "SocialPwned/core/main.py", line 109, in linkedinParameters
    users = linkedin.getCompanyEmployees(api,companies)
  File "SocialPwned/core/linkedin.py", line 46, in getCompanyEmployees
    employees = searchUsersOfCompany(api,nameCompany)
  File "SocialPwned/core/linkedin.py", line 84, in searchUsersOfCompany
    employees = api.search_people(keywords=nameCompany)
  File "SocialPwned/lib/LinkedInAPI/linkedin.py", line 177, in search_people
    data = self.search(params, limit=limit)
  File "SocialPwned/lib/LinkedInAPI/linkedin.py", line 107, in search
    for i in range(len(data["data"]["elements"])):
KeyError: 'data'
@MrTuxx
Copy link
Owner

MrTuxx commented Feb 27, 2021

Hello,

I have been going through the code and doing some tests. The problem seems to be when a company name has a comma in it, for example: "MyCompany, LLC".

This error also occurs when searching for employees when of the company "MyCompany, LLC".

To fix it I simply put a replace(',' ''), in the API call. I think it is enough because I have not identified more characters that generate an error.

Try now after applying the changes in master, if it is solved close the issue.

@Shraknard
Copy link
Author

Hi !

The changes you've made didn't worked for me but I noticed they were dashes and parenthesis in the name it failed on.
So I followed your lead with the replace strategy and its now working when I replace parenthesis in search_people() the same way you did with comas. Dashes seems not to be a problem.

I can now close the issue.
Thanks a lot for your fast answer and for the tool !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants