view 属性控制每条结果的 data 对象中出现哪些存储字段。该属性是各实体类型请求体的一部分。
view 接受哪些取值
| 视图 | 返回的数据 |
|---|---|
id_only | 仅标识符:公司为 company_id 和 linkedin_id,人物为 linkedin_num_id 和 linkedin_person_id |
summary | 各类目的紧凑记录:公司 14 个字段,人物 11 个字段 |
full | 全部已发布字段:公司 30 个,人物 36 个 |
{ "fields": [...] } | 仅指定的已发布字段 |
id_only,只返回标识符而非描述性字段。
fields 对象只有一个必填属性 fields,即已发布字段名组成的数组。本页公司表或人物表中的任一字段都是已发布字段。下面的请求为每条记录返回 8 个公司字段:
curl --request POST "https://api.brightdata.com/search/company" \
--header "Authorization: Bearer $BRIGHTDATA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"source": "linkedin_company",
"mode": "ludicrous",
"query": {
"and": [
{ "text": { "industry": "software" } },
{ "equals": { "headquarters_country_code": "US" } },
{ "range": { "employees_in_linkedin": { ">=": 50, "<=": 500 } } }
]
},
"offset": 0,
"limit": 10,
"view": {
"fields": ["name", "website", "industry", "headquarters_country_code", "employees_in_linkedin", "founded_year", "linkedin_followers", "url"]
}
}'
import os
import requests
response = requests.post(
"https://api.brightdata.com/search/company",
headers={
"Authorization": f"Bearer {os.environ['BRIGHTDATA_API_KEY']}",
"Content-Type": "application/json",
},
json={
"source": "linkedin_company",
"mode": "ludicrous",
"query": {
"and": [
{"text": {"industry": "software"}},
{"equals": {"headquarters_country_code": "US"}},
{"range": {"employees_in_linkedin": {">=": 50, "<=": 500}}},
]
},
"offset": 0,
"limit": 10,
"view": {
"fields": ["name", "website", "industry", "headquarters_country_code", "employees_in_linkedin", "founded_year", "linkedin_followers", "url"]
},
},
)
print(response.text)
const response = await fetch("https://api.brightdata.com/search/company", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.BRIGHTDATA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
source: "linkedin_company",
mode: "ludicrous",
query: {
and: [
{ text: { industry: "software" } },
{ equals: { headquarters_country_code: "US" } },
{ range: { employees_in_linkedin: { ">=": 50, "<=": 500 } } },
],
},
offset: 0,
limit: 10,
view: {
fields: ["name", "website", "industry", "headquarters_country_code", "employees_in_linkedin", "founded_year", "linkedin_followers", "url"],
},
}),
});
console.log(await response.text());
summary 未包含的 founded_year 无需请求 full 也能返回。
各视图为公司返回哪些字段
| 字段 | id_only | summary | full |
|---|---|---|---|
company_id | 是 | - | - |
linkedin_id | 是 | - | 是 |
name | - | 是 | 是 |
slogan | - | 是 | 是 |
industry | - | 是 | 是 |
headquarters_location | - | 是 | 是 |
headquarters_country_code | - | 是 | 是 |
offices_cities | - | 是 | 是 |
company_size_from | - | 是 | 是 |
company_size_to | - | 是 | 是 |
employees_in_linkedin | - | 是 | 是 |
linkedin_followers | - | 是 | 是 |
website | - | 是 | 是 |
domain | - | 是 | 是 |
url | - | 是 | 是 |
logo | - | 是 | 是 |
about | - | - | 是 |
specialties | - | - | 是 |
organization_type | - | - | 是 |
founded_year | - | - | 是 |
headquarters_city | - | - | 是 |
offices_country_codes | - | - | 是 |
alumni_count | - | - | 是 |
linkedin_follower_to_employee_ratio | - | - | 是 |
funding_stage | - | - | 是 |
funding_raised | - | - | 是 |
investor_names | - | - | 是 |
similar_company_ids | - | - | 是 |
affiliated_company_ids | - | - | 是 |
crunchbase_id | - | - | 是 |
image | - | - | 是 |
各视图为人物返回哪些字段
| 字段 | id_only | summary | full |
|---|---|---|---|
linkedin_num_id | 是 | - | 是 |
linkedin_person_id | 是 | - | 是 |
name | - | 是 | 是 |
current_title | - | 是 | 是 |
current_company_name | - | 是 | 是 |
current_company_industry | - | 是 | 是 |
location | - | 是 | 是 |
city | - | 是 | 是 |
country_code | - | 是 | 是 |
followers | - | 是 | 是 |
connections | - | 是 | 是 |
url | - | 是 | 是 |
avatar | - | 是 | 是 |
first_name | - | - | 是 |
about | - | - | 是 |
recommendations_count | - | - | 是 |
influencer | - | - | 是 |
patent_count | - | - | 是 |
current_tenure_months | - | - | 是 |
experience_years | - | - | 是 |
past_job_titles | - | - | 是 |
past_company_names | - | - | 是 |
past_company_ids | - | - | 是 |
education_schools | - | - | 是 |
education_details | - | - | 是 |
certification_names | - | - | 是 |
languages | - | - | 是 |
current_company_id | - | - | 是 |
current_company_specialties | - | - | 是 |
current_company_country_code | - | - | 是 |
current_company_size_from | - | - | 是 |
current_company_size_to | - | - | 是 |
current_company_funding_stage | - | - | 是 |
current_company_funding_raised | - | - | 是 |
similar_profile_ids | - | - | 是 |
also_viewed_ids | - | - | 是 |
data 中省略,而不是返回 null。同一请求返回的两条记录可能带有不同的键,一条 full 记录携带的键通常少于表中所列。bright_id 是每条记录中与 data 并列的信封字段,不通过 view 选择。
哪些 view 取值会被拒绝
Business Search 会以 HTTP 400 拒绝未知的视图名或未发布的字段名,error 属性会指出被拒绝的取值:
| 发送的取值 | 错误 |
|---|---|
"view": "bogus_view" | view: unknown view profile "bogus_view" |
"view": { "fields": ["not_a_released_field"] } | view: unknown field(s): not_a_released_field |
选作输出的字段不会成为搜索条件。在
view 中请求 founded_year 不会排除没有成立年份记录的公司。