Gruppierte Ergebnisse mit mehreren Filtern zählen
Artikel nach Feld zählen und mehrere Filter für Analyse-Dashboards anwenden
Eingabeparameter
| Parameter | Beschreibung | Typ | Standard | Erforderlich |
|---|---|---|---|---|
| title | Suchanfrage. | string | Ja | |
| facet | Artikel nach Feld zählen. | boolean | true | Ja |
| facet.field | Felder zum Zählen von Artikeln, durch Kommas getrennt. | string | Ja | |
| facet.limit | Maximale Anzahl gruppierter Werte pro Feld | integer | 10 | Ja |
| published_at.start | Startdatumsfilter. | string | Ja | |
| source.rank.opr.min | Mindest-Quellenqualität. | string | Ja | |
| api_key | Ihr API Schlüssel | string | Ja | |
| per_page | Maximale Anzahl von abzurufenden Artikeln | integer | 20 | Nein |
Workflow-Beispiele
Gruppieren Sie Ergebnisse nach einem Feld und zählen Sie sie, mit angewendeten Filtern:
curl -X GET "https://api.apitube.io/v1/news/everything?title=AI&facet=true&facet.field=source.id,category.id,language.id,sentiment.overall.polarity&facet.limit=10&published_at.start=2024-01-01&published_at.end=2024-01-31&source.rank.opr.min=5&api_key=YOUR_API_KEY"
Sprachverteilungsanalyse:
curl -X GET "https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet=true&facet.field=language.id,source.country.id&facet.limit=15&api_key=YOUR_API_KEY"
Medien-Bias-Verteilung:
curl -X GET "https://api.apitube.io/v1/news/everything?topic.id=industry.green_energy_news&facet=true&facet.field=source.bias,source.country.id&api_key=YOUR_API_KEY"
Artikel nach Stunde zählen:
curl -X GET "https://api.apitube.io/v1/news/everything?facet=true&facet.field=published.hour&published_at.start=2024-01-01&api_key=YOUR_API_KEY"
Verwandte Beispiele
- Holen Sie sich Artikelanzahlen nach Feld für die Analyse
- Artikel nach Bereich zählen
- Artikel nach Feldwerten und Bereichen zählen
- Wählen Sie spezifische Felder aus
- Sortieren nach Engagement-Score
Rezept für cURL
curl --location --globoff --request POST 'https://api.apitube.io/v1/news/everything?title=AI&facet=1&facet.field=source.id%2Ccategory.id%2Clanguage.id%2Csentiment.overall.polarity&facet.limit=10&published_at.start=2024-01-01&source.rank.opr.min=5&api_key=YOUR_API_KEY&per_page=20' \
--header 'Content-Type: application/json'
Rezept für Python
import requests
url = "https://api.apitube.io/v1/news/everything"
querystring = {
"title": "AI",
"facet": true,
"facet.field": "source.id,category.id,language.id,sentiment.overall.polarity",
"facet.limit": 10,
"published_at.start": "2024-01-01",
"source.rank.opr.min": 5,
"api_key": "YOUR_API_KEY",
"per_page": 20
}
response = requests.request("GET", url, params=querystring)
print(response.text)
Rezept für Javascript
import axios from "axios"
const options = {
method: 'GET',
url: 'https://api.apitube.io/v1/news/everything',
params: {
"title": "AI",
"facet": true,
"facet.field": "source.id,category.id,language.id,sentiment.overall.polarity",
"facet.limit": 10,
"published_at.start": "2024-01-01",
"source.rank.opr.min": 5,
"api_key": "YOUR_API_KEY",
"per_page": 20
}};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Rezept für PHP
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('GET', 'https://api.apitube.io/v1/news/everything', [
'query' => [
'title' => 'AI',
'facet' => 1,
'facet.field' => 'source.id,category.id,language.id,sentiment.overall.polarity',
'facet.limit' => 10,
'published_at.start' => '2024-01-01',
'source.rank.opr.min' => 5,
'api_key' => 'YOUR_API_KEY',
'per_page' => 20,
],
]);
echo $response->getBody();
Rezept für 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?title=AI&facet=1&facet.field=source.id%2Ccategory.id%2Clanguage.id%2Csentiment.overall.polarity&facet.limit=10&published_at.start=2024-01-01&source.rank.opr.min=5&api_key=YOUR_API_KEY&per_page=20")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();