我正在尝试搜索和检索Alchemy Data News上的新闻文章。我可以使用实体获得结果:
https://access.alchemyapi.com/calls/data/GetNews?apikey=[redacted]&outputMode=json&start=now-60d&end=now-0d&maxResults=10&return=enriched.url.title,enriched.url.url,enriched.url.entities,enriched.url.concepts&q.enriched.url.entities.entity=|text=Neil%20Tyson,type=Person|
我可以使用关键字获得结果:
https://access.alchemyapi.com/calls/data/GetNews?apikey=[redacted]&outputMode=json&start=now-60d&end=now-0d&maxResults=10&return=enriched.url.title,enriched.url.url,enriched.url.entities,enriched.url.concepts&q.enriched.url.enrichedTitle.keywords.keyword.text=solar%20System
但如果我将两者结合起来,我会得到说“OK”的结果:
https://access.alchemyapi.com/calls/data/GetNews?apikey=[redacted]&outputMode=json&start=now-60d&end=now-0d&maxResults=10&return=enriched.url.title,enriched.url.url,enriched.url.entities,enriched.url.concepts&q.enriched.url.enrichedTitle.keywords.keyword.text=solar%20System&q.enriched.url.entities.entity=|text=Neil%20Tyson,type=Person|
{
"status": "OK",
"usage": "By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html",
"totalTransactions": "4320",
"result": {
"status": "OK"
}
没有文档。这应该是可行的,还是我在错误的树上咆哮?
答案 0 :(得分:2)
问题是您创建了一个包含0结果的查询。如果删除查询的& return部分,则响应将仅包含计数。您还可以添加& timeSlice以按时间段查看结果(更多关于计数和时间片here)。使用每月时间片(& timeSlice = 1M)运行组合查询将返回:
"status": "OK",
"totalTransactions": "4322",
"result": {
"count": 0,
"slices": [
0,
0
],
"status": "OK"
}
结合实体和概念以及许多近期/主题响应(至少在2016年2月)的一个例子是用B.o.B取代太阳系:
https://access.alchemyapi.com/calls/data/GetNews?outputMode=json&start=now-60d&end=now-0d&maxResults=10&return=enriched.url.title&enriched.url.url&enriched.url.entities&enriched.url.concepts&q.enriched.url.entities.entity.text=Neil+Tyson&type=Person&q.enriched.url.enrichedTitle.keywords.keyword.text=B.o.B&apikey=<YOUR API KEY>
这就是这项服务的重点所在,查询并帮助确定最近新闻的趋势。