Source Query Examples
Getting news from a specific source
This query retrieves news articles from The Guardian domain.
bash
curl "https://api.apitube.io/v1/news/everything?source.domain=theguardian.com&api_key=YOUR_API_KEY"python
import requests
response = requests.get(
"https://api.apitube.io/v1/news/everything",
params={
"source.domain": "theguardian.com",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())javascript
const params = new URLSearchParams({ "source.domain": "theguardian.com", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`);
const data = await response.json();
console.log(data);php
$query = http_build_query(["source.domain" => "theguardian.com", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/everything?$query");
$data = json_decode($response, true);
print_r($data);go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/everything")
q := u.Query()
q.Set("source.domain", "theguardian.com")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/everything?source.domain=theguardian.com&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}text
Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/everything?source.domain=theguardian.com
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/parametersNews from multiple sources
This query retrieves news articles from The Guardian and The New York Times domains.
bash
curl "https://api.apitube.io/v1/news/everything?source.domain=theguardian.com%2Cnytimes.com&api_key=YOUR_API_KEY"python
import requests
response = requests.get(
"https://api.apitube.io/v1/news/everything",
params={
"source.domain": "theguardian.com,nytimes.com",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())javascript
const params = new URLSearchParams({ "source.domain": "theguardian.com,nytimes.com", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`);
const data = await response.json();
console.log(data);php
$query = http_build_query(["source.domain" => "theguardian.com,nytimes.com", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/everything?$query");
$data = json_decode($response, true);
print_r($data);go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/everything")
q := u.Query()
q.Set("source.domain", "theguardian.com,nytimes.com")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/everything?source.domain=theguardian.com%2Cnytimes.com&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}text
Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/everything?source.domain=theguardian.com%2Cnytimes.com
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/parametersFiltering by source and language
This query retrieves news articles from Fox News in English.
bash
curl "https://api.apitube.io/v1/news/everything?source.domain=foxnews.com&language.code=en&api_key=YOUR_API_KEY"python
import requests
response = requests.get(
"https://api.apitube.io/v1/news/everything",
params={
"source.domain": "foxnews.com",
"language.code": "en",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())javascript
const params = new URLSearchParams({ "source.domain": "foxnews.com", "language.code": "en", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`);
const data = await response.json();
console.log(data);php
$query = http_build_query(["source.domain" => "foxnews.com", "language.code" => "en", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/everything?$query");
$data = json_decode($response, true);
print_r($data);go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/everything")
q := u.Query()
q.Set("source.domain", "foxnews.com")
q.Set("language.code", "en")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/everything?source.domain=foxnews.com&language.code=en&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}text
Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/everything?source.domain=foxnews.com&language.code=en
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/parametersFiltering by source rating
This query retrieves news articles with a source rating from 0.5 to 0.9.
bash
curl "https://api.apitube.io/v1/news/everything?source.rank.opr.min=0.5&source.rank.opr.max=0.9&api_key=YOUR_API_KEY"python
import requests
response = requests.get(
"https://api.apitube.io/v1/news/everything",
params={
"source.rank.opr.min": "0.5",
"source.rank.opr.max": "0.9",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())javascript
const params = new URLSearchParams({ "source.rank.opr.min": "0.5", "source.rank.opr.max": "0.9", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`);
const data = await response.json();
console.log(data);php
$query = http_build_query(["source.rank.opr.min" => "0.5", "source.rank.opr.max" => "0.9", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/everything?$query");
$data = json_decode($response, true);
print_r($data);go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/everything")
q := u.Query()
q.Set("source.rank.opr.min", "0.5")
q.Set("source.rank.opr.max", "0.9")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/everything?source.rank.opr.min=0.5&source.rank.opr.max=0.9&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}text
Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/everything?source.rank.opr.min=0.5&source.rank.opr.max=0.9
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/parametersCross-regional media bias analysis
This query analyzes differences in green energy coverage from different countries.
bash
curl "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&source.country.code=us%2Cde%2Cgb&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY"python
import requests
response = requests.get(
"https://api.apitube.io/v1/news/everything",
params={
"topic.id": "industry.green_energy_news",
"source.country.code": "us,de,gb",
"sort.by": "sentiment.overall.score",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())javascript
const params = new URLSearchParams({ "topic.id": "industry.green_energy_news", "source.country.code": "us,de,gb", "sort.by": "sentiment.overall.score", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`);
const data = await response.json();
console.log(data);php
$query = http_build_query(["topic.id" => "industry.green_energy_news", "source.country.code" => "us,de,gb", "sort.by" => "sentiment.overall.score", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/everything?$query");
$data = json_decode($response, true);
print_r($data);go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/everything")
q := u.Query()
q.Set("topic.id", "industry.green_energy_news")
q.Set("source.country.code", "us,de,gb")
q.Set("sort.by", "sentiment.overall.score")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&source.country.code=us%2Cde%2Cgb&sort.by=sentiment.overall.score&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}text
Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&source.country.code=us%2Cde%2Cgb&sort.by=sentiment.overall.score
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/parametersPolitical news comparison across ideological spectrums
This query compares political coverage between liberal and conservative-leaning news sources.
bash
curl "https://api.apitube.io/v1/news/everything?category.id=medtop%3A11000000&source.domain=nytimes.com%2Cfoxnews.com%2Ctheguardian.com&title=election%2Cpresident%2Ccongress&sort.by=source.domain&api_key=YOUR_API_KEY"python
import requests
response = requests.get(
"https://api.apitube.io/v1/news/everything",
params={
"category.id": "medtop:11000000",
"source.domain": "nytimes.com,foxnews.com,theguardian.com",
"title": "election,president,congress",
"sort.by": "source.domain",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())javascript
const params = new URLSearchParams({ "category.id": "medtop:11000000", "source.domain": "nytimes.com,foxnews.com,theguardian.com", "title": "election,president,congress", "sort.by": "source.domain", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`);
const data = await response.json();
console.log(data);php
$query = http_build_query(["category.id" => "medtop:11000000", "source.domain" => "nytimes.com,foxnews.com,theguardian.com", "title" => "election,president,congress", "sort.by" => "source.domain", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/everything?$query");
$data = json_decode($response, true);
print_r($data);go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/everything")
q := u.Query()
q.Set("category.id", "medtop:11000000")
q.Set("source.domain", "nytimes.com,foxnews.com,theguardian.com")
q.Set("title", "election,president,congress")
q.Set("sort.by", "source.domain")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/everything?category.id=medtop%3A11000000&source.domain=nytimes.com%2Cfoxnews.com%2Ctheguardian.com&title=election%2Cpresident%2Ccongress&sort.by=source.domain&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}text
Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/everything?category.id=medtop%3A11000000&source.domain=nytimes.com%2Cfoxnews.com%2Ctheguardian.com&title=election%2Cpresident%2Ccongress&sort.by=source.domain
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/parametersRegional technology coverage comparison
This query analyzes how technology innovations are covered by sources from different regions.
bash
curl "https://api.apitube.io/v1/news/everything?category.id=medtop%3A13000000&source.country.code=us%2Cgb%2Cin%2Cde&title=artificial%20intelligence%2Cmachine%20learning%2Crobotics&sort.by=source.country.code&api_key=YOUR_API_KEY"python
import requests
response = requests.get(
"https://api.apitube.io/v1/news/everything",
params={
"category.id": "medtop:13000000",
"source.country.code": "us,gb,in,de",
"title": "artificial intelligence,machine learning,robotics",
"sort.by": "source.country.code",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())javascript
const params = new URLSearchParams({ "category.id": "medtop:13000000", "source.country.code": "us,gb,in,de", "title": "artificial intelligence,machine learning,robotics", "sort.by": "source.country.code", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`);
const data = await response.json();
console.log(data);php
$query = http_build_query(["category.id" => "medtop:13000000", "source.country.code" => "us,gb,in,de", "title" => "artificial intelligence,machine learning,robotics", "sort.by" => "source.country.code", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/everything?$query");
$data = json_decode($response, true);
print_r($data);go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/everything")
q := u.Query()
q.Set("category.id", "medtop:13000000")
q.Set("source.country.code", "us,gb,in,de")
q.Set("title", "artificial intelligence,machine learning,robotics")
q.Set("sort.by", "source.country.code")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/everything?category.id=medtop%3A13000000&source.country.code=us%2Cgb%2Cin%2Cde&title=artificial%20intelligence%2Cmachine%20learning%2Crobotics&sort.by=source.country.code&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}text
Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/everything?category.id=medtop%3A13000000&source.country.code=us%2Cgb%2Cin%2Cde&title=artificial%20intelligence%2Cmachine%20learning%2Crobotics&sort.by=source.country.code
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/parametersSpecialized industry source analysis
This query focuses on cryptocurrency coverage from specialized sources.
bash
curl "https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&title=Bitcoin%2CEthereum%2Cblockchain&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY"python
import requests
response = requests.get(
"https://api.apitube.io/v1/news/everything",
params={
"topic.id": "industry.crypto_news",
"title": "Bitcoin,Ethereum,blockchain",
"sort.by": "sentiment.overall.score",
"sort.order": "desc",
"api_key": "YOUR_API_KEY",
},
)
print(response.json())javascript
const params = new URLSearchParams({ "topic.id": "industry.crypto_news", "title": "Bitcoin,Ethereum,blockchain", "sort.by": "sentiment.overall.score", "sort.order": "desc", "api_key": "YOUR_API_KEY" });
const response = await fetch(`https://api.apitube.io/v1/news/everything?${params}`);
const data = await response.json();
console.log(data);php
$query = http_build_query(["topic.id" => "industry.crypto_news", "title" => "Bitcoin,Ethereum,blockchain", "sort.by" => "sentiment.overall.score", "sort.order" => "desc", "api_key" => "YOUR_API_KEY"]);
$response = file_get_contents("https://api.apitube.io/v1/news/everything?$query");
$data = json_decode($response, true);
print_r($data);go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
u, _ := url.Parse("https://api.apitube.io/v1/news/everything")
q := u.Query()
q.Set("topic.id", "industry.crypto_news")
q.Set("title", "Bitcoin,Ethereum,blockchain")
q.Set("sort.by", "sentiment.overall.score")
q.Set("sort.order", "desc")
q.Set("api_key", "YOUR_API_KEY")
u.RawQuery = q.Encode()
resp, _ := http.Get(u.String())
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]any
json.Unmarshal(body, &data)
fmt.Println(data)
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&title=Bitcoin%2CEthereum%2Cblockchain&sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}text
Write a script in your preferred language that calls the APITube News API:
GET https://api.apitube.io/v1/news/everything?topic.id=industry.crypto_news&title=Bitcoin%2CEthereum%2Cblockchain&sort.by=sentiment.overall.score&sort.order=desc
Read the API key from an environment variable (do not hardcode it), handle request
errors, and print the key fields of each result.
Docs: https://docs.apitube.io/platform/news-api/parameters