Cross-regional media bias analysis
Analyze media bias across regions for specific topics with sentiment and time filtering
输入参数
| Parameter | Description | Type | Default | Required |
|---|---|---|---|---|
| topic.id | Topic filter. | string | Yes | |
| source.country.code | Multiple country codes (comma-separated). | string | Yes | |
| sort.by | Sort by sentiment score. | string | Yes | |
| published_at.start | Start date filter. | string | Yes | |
| published_at.end | End date filter. | string | Yes | |
| facet | Enable faceting. | boolean | true | Yes |
| facet.field | Fields for faceting. | string | Yes | |
| api_key | Your API key. | string | Yes | |
| per_page | Maximum number of articles to retrieve. | integer | 50 | No |
Workflow examples
Request for cross-regional media bias analysis:
curl -X GET "https://api.apitube.io/v1/news/everything?topic.id=climate_change&source.country.code=us,ru,cn&sort.by=sentiment.overall.score&published_at.start=2023-01-01&published_at.end=2023-12-31&api_key=YOUR_API_KEY"
Request for media bias distribution:
curl -X GET "https://api.apitube.io/v1/news/everything?topic.id=climate_change&facet=true&facet.field=source.bias,source.country.id&api_key=YOUR_API_KEY"
食谱 cURL
curl --location --globoff --request POST 'https://api.apitube.io/v1/news/everything?topic.id=climate_change&source.country.code=us%2Cru%2Ccn&sort.by=sentiment.overall.score&published_at.start=2023-01-01&published_at.end=2023-12-31&facet=1&facet.field=source.bias%2Csource.country.id&api_key=YOUR_API_KEY&per_page=50' \
--header 'Content-Type: application/json'
食谱 Python
import requests
url = "https://api.apitube.io/v1/news/everything"
querystring = {
"topic.id": "climate_change",
"source.country.code": "us,ru,cn",
"sort.by": "sentiment.overall.score",
"published_at.start": "2023-01-01",
"published_at.end": "2023-12-31",
"facet": true,
"facet.field": "source.bias,source.country.id",
"api_key": "YOUR_API_KEY",
"per_page": 50
}
response = requests.request("GET", url, params=querystring)
print(response.text)
食谱 Javascript
import axios from "axios"
const options = {
method: 'GET',
url: 'https://api.apitube.io/v1/news/everything',
params: {
"topic.id": "climate_change",
"source.country.code": "us,ru,cn",
"sort.by": "sentiment.overall.score",
"published_at.start": "2023-01-01",
"published_at.end": "2023-12-31",
"facet": true,
"facet.field": "source.bias,source.country.id",
"api_key": "YOUR_API_KEY",
"per_page": 50
}};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
食谱 PHP
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('GET', 'https://api.apitube.io/v1/news/everything', [
'query' => [
'topic.id' => 'climate_change',
'source.country.code' => 'us,ru,cn',
'sort.by' => 'sentiment.overall.score',
'published_at.start' => '2023-01-01',
'published_at.end' => '2023-12-31',
'facet' => 1,
'facet.field' => 'source.bias,source.country.id',
'api_key' => 'YOUR_API_KEY',
'per_page' => 50,
],
]);
echo $response->getBody();
食谱 Java
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.apitube.io/v1/news/everything?topic.id=climate_change&source.country.code=us%2Cru%2Ccn&sort.by=sentiment.overall.score&published_at.start=2023-01-01&published_at.end=2023-12-31&facet=1&facet.field=source.bias%2Csource.country.id&api_key=YOUR_API_KEY&per_page=50")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();