Javascript 从Guardian API获取文章文本
我在从卫报的新闻API获取文章文本时遇到问题。我有一个类似以下内容的url: 我得到的回答是这样的:Javascript 从Guardian API获取文章文本,javascript,api,object,Javascript,Api,Object,我在从卫报的新闻API获取文章文本时遇到问题。我有一个类似以下内容的url: 我得到的回答是这样的: { "response": { "status": "ok", "userTier": "developer", "total": 54530, "startIndex": 1, "pageSize": 10, "currentPage": 1, "pages": 5453, "orderBy": "newest", "re
{
"response": {
"status": "ok",
"userTier": "developer",
"total": 54530,
"startIndex": 1,
"pageSize": 10,
"currentPage": 1,
"pages": 5453,
"orderBy": "newest",
"results": [{
"type": "article",
"sectionId": "technology",
"webTitle": "Net neutrality has its day in court – with lawyers, Christians and the Cheshire Cat",
"webPublicationDate": "2015-12-05T12:30:06Z",
"id": "technology/2015/dec/05/net-neutrality-has-its-day-in-court-with-lawyers-christians-and-the-cheshire-cat",
"webUrl": "http://www.theguardian.com/technology/2015/dec/05/net-neutrality-has-its-day-in-court-with-lawyers-christians-and-the-cheshire-cat",
"apiUrl": "http://content.guardianapis.com/technology/2015/dec/05/net-neutrality-has-its-day-in-court-with-lawyers-christians-and-the-cheshire-cat",
"sectionName": "Technology"
}, {
"type": "article",
"sectionId": "technology",
"webTitle": "Five things we love: from a school-proof tablet to a ghostly Serbian bicycle",
"webPublicationDate": "2015-12-05T10:00:02Z",
"id": "technology/2015/dec/05/five-things-we-love",
"webUrl": "http://www.theguardian.com/technology/2015/dec/05/five-things-we-love",
"apiUrl": "http://content.guardianapis.com/technology/2015/dec/05/five-things-we-love",
"sectionName": "Technology"
}, {
"type": "article",
"sectionId": "technology",
"webTitle": "Don’t listen to those who try to own the definition of a video game",
"webPublicationDate": "2015-12-04T12:00:21Z",
"id": "technology/2015/dec/04/video-games-gaming-dudegamers",
"webUrl": "http://www.theguardian.com/technology/2015/dec/04/video-games-gaming-dudegamers",
"apiUrl": "http://content.guardianapis.com/technology/2015/dec/04/video-games-gaming-dudegamers",
"sectionName": "Technology"
}]
}
}
这不包括文章文本,只包括新闻页面的url我的问题是如何获取文章文本?尝试添加
show blocks=all&
以查询url处返回的属性。下面的URL可以分解为:基本URL:
http://content.guardianapis.com/search?
搜索参数的开始:
q=
搜索参数(全部“”替换为“%20”):
12%20years%20a%20lave&
转换为json格式:
format=json&
按特定标签过滤:
tag=film/film、tone/reviews&
按开始日期筛选:
从日期=2010-01-01&
相关性排序:
相关性排序&
显示完整的API哈希:
Show blocks=all&
您的API密钥(应将密钥放在“测试”的位置):
API Key=test
请参见将
显示字段
键和正文
键值添加到您的URL,然后您将获得内容
e、 g:显示字段=正文
您大概不会,因为以易于重新发布的格式提供完整的文章不符合他们的商业模式。您是否尝试调用返回的
apirl
?它需要一个API密钥,可能是全文。@C.Kelly查询参数应该是12%20
beforeyears