Skip to main content
 首页 » 编程设计

python之领英公司搜索 API : Get All Counts

2025年05月04日7kuangbin

我需要获取 Linkedin 上尽可能多的上市公司的员工规模范围。我使用 Python,获得了 LinkedIn API。

但是,查询只返回前 10 个计数。您如何获得返回所有列出的计数的查询?

application = linkedin.LinkedInApplication(authentication) 
application.search_company(selectors=[{'companies': ['name', 'employee-count-range']}]) 

结果:只有 10 家公司列在输出中。如何获取所有公司?

请您参考如下方法:

根据 LinkedIn API Documentation

count: The number of jobs to return. Values can range between 0 and 110. The default value is 10. The total results available to any user depends on their account level.

并根据Python LinkedIn Documentation示例(尽管这不是 search_company,而是 search_job 方法,此解决方案也适用于 search_company):

application.search_job(selectors=[{'jobs': ['id', 
                                            'customer-job-code', 
                                            'posting-date']}], 
                       params={'title': 'python', 'count': 2}) 
# Output 
{u'jobs': {u'_count': 2, 
  u'_start': 0, 
  u'_total': 206747, 
  u'values': [{u'customerJobCode': u'0006YT23WQ', 
    u'id': 5174636, 
    u'postingDate': {u'day': 21, u'month': 3, u'year': 2013}}, 
   {u'customerJobCode': u'00023CCVC2', 
    u'id': 5174634, 
    u'postingDate': {u'day': 21, u'month': 3, u'year': 2013}}]}} 

您应该使用 count 键传递 params 字典。