A Java/JVM wrapper for newsapi.org.
Javadoc is yet to be released.
First grab a key from the account page.
import xyz.thegrapevine.jnewsapi.*;
public class Example {
public static void main(String[] args) {
NewsClient client = new NewsClient("key");
// Sources
SourcesResponse response = client.sources();
// Top headlines querying with "bitcoin"
TopHeadlinesResponse headlines = client.topHeadlines(new HTTPParameter("q", "bitcoin"));
// Everything querying CNN
EverythingResponse everything = client.everything("sources", "cnn");
}
}
<repositories>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>
<dependency>
<groupId>xyz.thegrapevine</groupId>
<artifactId>JNewsAPI</artifactId>
<version>2.0.0</version>
<type>pom</type>
</dependency>
repositories {
jcenter()
}
dependencies {
implementation "xyz.thegrapevine:JNewsAPI:2.0.0"
}
This library is licensed under the Apache 2.0 license.