query 的形式、公司搜索可筛选的字段及各字段接受的运算符,以及请求的写法。
公司请求发送到 POST /search/company。 职业档案见人物搜索。如需查找公司搜索返回的公司中的人物,参见如何运行多步搜索。
编写查询
query 的形式取决于搜索模式:
- Ludicrous 接受一个 JSON 对象,由可搜索字段上的条件通过
and、or和not组合而成。操作符和取值形式参见 Business Search 查询语法。 - Instant 和 Smart 接受一句不超过 200 个字符的自然语言。Business Search 会把这句话转换为作用于同一组字段的一个结构化查询。点名或描述某一家公司的句子按公司名称和口号排序;按行业或属性查找一组公司的句子按每家公司的业务排序,即其
about、specialties、industry和slogan字段。
可搜索字段
字段接受哪些运算符取决于字段类型。文本类型字段只接受text 运算符;字符串、整数等有类型字段接受 equals、in 和 range。对文本字段使用 equals 会返回 HTTP 400。
| 字段 | 类型 | 运算符 | 说明 |
|---|---|---|---|
industry | 文本 | text | 按词匹配,例如 software |
name | 文本 | text | 公司名称 |
about、slogan、specialties | 文本 | text | 描述性文本。参见示例 |
headquarters_location | 文本 | text | 描述性地点字符串 |
headquarters_country_code | 字符串 | equals、in | ISO 3166 alpha-2 代码,例如 US 或 GB |
headquarters_city | 字符串 | equals | 精确城市名 |
offices_country_codes | 字符串数组 | in | 设有办公室的国家。参见示例 |
offices_cities | 字符串数组 | in | 设有办公室的城市 |
organization_type | 字符串 | equals | Privately Held、Public Company、Nonprofit、Educational、Self-Employed 或 Government Agency 之一 |
founded_year | 整数 | range、equals | |
employees_in_linkedin | 整数 | range | 数据源记录的员工数 |
company_size_from、company_size_to | 整数 | range | 自报的规模区间 |
funding_stage | 字符串 | equals、in | 最近一轮融资类型 |
funding_raised | 整数 | range | 最近一轮融资金额(美元) |
linkedin_followers | 整数 | range | 关注者数量 |
funding_stage 接受 pre-seed、seed、angel、series-a、series-b、series-c、series-d、series-e、series-unknown、grant、debt、convertible-note、crowdfunding、non-equity-assistance、corporate-round、private-equity 和 undisclosed。
employees_in_linkedin 是数据源档案中记录的员工数,不能当作公司的实际总人数,且约 40% 的公司记录将其存为 0。要获得可靠的规模筛选,请把它与 company_size_from、company_size_to 区间组合,并让其下限不低于 1:{
"and": [
{ "range": { "employees_in_linkedin": { ">=": 50, "<=": 200 } } },
{ "range": { "company_size_from": { "<=": 200 } } },
{ "range": { "company_size_to": { ">=": 50 } } }
]
}
示例请求
- Ludicrous
- Instant
- Smart
以下 Ludicrous 请求查找行业中包含 示例响应返回的三条记录中的第一条:
software、记录中的员工数在 50 到 500 之间的美国公司,并指定 7 个输出字段:示例请求curl --request POST "https://api.brightdata.com/search/company" \
--header "Authorization: Bearer $BRIGHTDATA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"mode": "ludicrous",
"query": {
"and": [
{ "text": { "industry": "software" } },
{ "equals": { "headquarters_country_code": "US" } },
{ "range": { "employees_in_linkedin": { ">=": 50, "<=": 500 } } }
]
},
"offset": 0,
"limit": 3,
"view": {
"fields": [
"name", "website", "industry", "headquarters_country_code",
"employees_in_linkedin", "founded_year", "linkedin_followers"
]
}
}'
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={
"mode": "ludicrous",
"query": {
"and": [
{ "text": { "industry": "software" } },
{ "equals": { "headquarters_country_code": "US" } },
{ "range": { "employees_in_linkedin": { ">=": 50, "<=": 500 } } }
]
},
"offset": 0,
"limit": 3,
"view": {
"fields": [
"name", "website", "industry", "headquarters_country_code",
"employees_in_linkedin", "founded_year", "linkedin_followers"
]
}
},
)
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({
"mode": "ludicrous",
"query": {
"and": [
{ "text": { "industry": "software" } },
{ "equals": { "headquarters_country_code": "US" } },
{ "range": { "employees_in_linkedin": { ">=": 50, "<=": 500 } } }
]
},
"offset": 0,
"limit": 3,
"view": {
"fields": [
"name", "website", "industry", "headquarters_country_code",
"employees_in_linkedin", "founded_year", "linkedin_followers"
]
}
}),
});
console.log(await response.text());
{
"req_id": "ra2cfffad23ad45afb987cd62e821e33b",
"source": "linkedin_company",
"meta": {
"coverage_percent": 100,
"matched": 8,
"offset": 0,
"limit": 3
},
"documents": [
{
"bright_id": "70e11d46b2a9e65ff0a55a0541c5b0592f2e98360b67eae27c5f605a51afb3d4",
"data": {
"name": "Splashtop Inc.",
"website": "https://www.splashtop.com/",
"industry": "Software Development",
"headquarters_country_code": "US",
"employees_in_linkedin": 350,
"founded_year": 2006,
"linkedin_followers": 29668
}
}
]
}
以下 Instant 请求用一句话查找同一类公司:示例请求示例响应返回的三条记录中的第一条,已省略
curl --request POST "https://api.brightdata.com/search/company" \
--header "Authorization: Bearer $BRIGHTDATA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"mode": "instant",
"query": "US software companies with 50 to 500 employees",
"limit": 3,
"view": "summary"
}'
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={
"mode": "instant",
"query": "US software companies with 50 to 500 employees",
"limit": 3,
"view": "summary"
},
)
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({
"mode": "instant",
"query": "US software companies with 50 to 500 employees",
"limit": 3,
"view": "summary"
}),
});
console.log(await response.text());
url 和 logo:{
"req_id": "r6581e80b2c034f49b7155d5d192c28f5",
"source": "linkedin_company",
"meta": {
"coverage_percent": 100,
"matched": 595,
"offset": 0,
"limit": 3
},
"documents": [
{
"bright_id": "7b8d489b82344beae097e05cddfcf1da56ed51e37fab6fc64b2ca58e7b0713bd",
"data": {
"name": "SourceForge",
"slogan": "The complete software platform. SourceForge is the largest B2B software review and comparison directory in the world.",
"industry": "Software Development",
"headquarters_location": "San Diego, California",
"headquarters_country_code": "US",
"offices_cities": [
"San Diego"
],
"company_size_from": 51,
"company_size_to": 200,
"employees_in_linkedin": 59,
"linkedin_followers": 39185,
"website": "https://sourceforge.net/",
"domain": "sourceforge.net"
}
}
]
}
以下 Smart 请求发送同一句话,并按每条记录对请求的契合程度对候选结果排序:示例请求示例响应返回的三条记录中的第一条,已省略
curl --request POST "https://api.brightdata.com/search/company" \
--header "Authorization: Bearer $BRIGHTDATA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"mode": "smart",
"query": "US software companies with 50 to 500 employees",
"limit": 3,
"view": "summary"
}'
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={
"mode": "smart",
"query": "US software companies with 50 to 500 employees",
"limit": 3,
"view": "summary"
},
)
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({
"mode": "smart",
"query": "US software companies with 50 to 500 employees",
"limit": 3,
"view": "summary"
}),
});
console.log(await response.text());
url 和 logo:{
"req_id": "ra093a71684884dee9aaeb13d15b4f300",
"source": "linkedin_company",
"meta": {
"coverage_percent": 100,
"matched": 593,
"offset": 0,
"limit": 3
},
"documents": [
{
"bright_id": "89d3d02c7227eb19214e0912d980e84e56ad89e19a49f81a4924d13b844d2762",
"data": {
"name": "BQE Software",
"slogan": "All-in-one Firm Management Software for Engineers, Architects, Consultants, & Professional Services Firms.",
"industry": "Software Development",
"headquarters_location": "West Hollywood, CA",
"headquarters_country_code": "US",
"offices_cities": [
"West Hollywood"
],
"company_size_from": 201,
"company_size_to": 500,
"employees_in_linkedin": 409,
"linkedin_followers": 28157,
"website": "https://www.bqe.com/",
"domain": "bqe.com"
}
}
]
}
view 与 query 的关系,参见 Business Search 字段视图。
更多经过测试的请求,参见 Business Search 查询示例。