val qSearch = SearchQuery()import org.joda.time.DateTimeval startDate = DateTime.now().minusDays(1)val endDate = DateTime.now().minusDays(1)val fields = "firstPublicationDate,headline,trailText,body,byline,shortUrl"
val tags = "all"
.pageSize(200)
.page(1)
.showFields(fields)
.showTags(tags)
.orderBy("newest")
.useDate("published")
.fromDate(startDate)
.toDate(endDate)
the request
qSearch.toString
/search?order-by=newest&page-size=200&to-date=2016-07-24T01%3A12%3A33.120%2B01%3A00&page=1&use-date=published&show-fields=firstPublicationDate%2Cheadline%2CtrailText%2Cbody%2Cbyline%2CshortUrl&show-tags=all&from-date=2016-07-24T01%3A12%3A33.120%2B01%3A00
val client = new GuardianContentClient("your-api-key")
client.getResponse(qSearch) map { response => println(response.total) }
--
You received this message because you are subscribed to the Google Groups "Guardian Open Platform API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-t...@googlegroups.com.
To post to this group, send email to guardian...@googlegroups.com.
Visit this group at https://groups.google.com/group/guardian-api-talk.
For more options, visit https://groups.google.com/d/optout.
client.getResponse(qSearch).foreach(response => {
response.results.map(GNewsArticle(_)) |> resultProcessor
AppLogger(s"\tQuery ${qSearch.toString()} has ${response.pages + 1} pages of size ${response.pageSize} i.e. ${response.total}")
if (response.pages > 1)
(2 to response.pages)
.foreach(pi => client.getResponse(qSearch.page(pi)).foreach(r => r.results.map(GNewsArticle(_)) |> resultProcessor))
})
val startDate = DateTime.now().minusDays(1)val endDate = DateTime.now().minusDays(1)
You want:
val startDate = DateTime.now().minusDays(1)..withTimeAtStartOfDay()val endDate = DateTime.now().minusDays(1).millisOfDay().withMaximumValue()