Linkedin API的search_people方法current_company参数异常问题
解决LinkedIn API查询指定公司在职人员返回空列表的问题
确认IBM的正确LinkedIn公司ID:
旧的公司ID可能失效,先通过search_companies接口获取最新的IBM公司ID:from linkedin_api import Linkedin api = Linkedin('your_email@example.com', 'your_password') companies = api.search_companies('IBM') print(companies) # 从返回结果中提取IBM的companyId字段值调整
search_people的参数格式:
部分版本的linkedin-api库要求current_company参数传入列表而非单个字符串,修改代码如下:# 假设获取到的IBM正确ID是'1009'(实际以search_companies返回的为准) results = api.search_people(current_company=['1009']) print(results)增加辅助搜索参数:
免费LinkedIn账号的搜索权限有限,可添加keywords、location等参数缩小范围,避免因结果限制返回空:results = api.search_people( current_company=['1009'], keywords='software engineer', location='United States' ) print(results)更新库版本:
旧版本库可能存在参数兼容问题,执行命令更新到最新版:pip install --upgrade linkedin-api
内容的提问来源于stack exchange,提问作者Lucas R.
相关产品推荐
相关产品推荐

