News Bias Analyzer
News Bias Analyzer 路 Acciones GPT
News Bias Analyzer API
This is an API for generating news bias graph images and generating wordcloud images.
GET /download/{folder}/{filename}Download ImagePOST /top-headlines/Get Top HeadlinesFetches top headlines for a given country, and optionally for a specific category.
POST /top-headlines/sourcesGet SourcesReturns the subset of news publishers that top headlines are available from.
POST /search-articles/Search ArticlesSearches through all articles based on a query.
POST /process_news_articleProcess News ArticleRetrieves and processes the content of a news article.
POST /generate_bias_graphGenerate Bias GraphGenerates a bias graph and returns the URL to the generated image.
POST /generate_wordcloudGenerate Word CloudGenerates a word cloud and returns the URL to the generated image.
Esquema original API
{
"openapi": "3.1.0",
"info": {
"title": "News Bias Analyzer API",
"description": "This is an API for generating news bias graph images and generating wordcloud images.",
"version": "1.0.0"
},
"servers": [
{
"url": "https://cybrix.ai/newsbiasanalyzer",
"description": "News Bias Analyzer API"
}
],
"paths": {
"/download/{folder}/{filename}": {
"get": {
"summary": "Download Image",
"operationId": "download_image_download__folder___filename__get",
"parameters": [
{
"name": "folder",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Folder"
}
},
{
"name": "filename",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Filename"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
},
"image/png": {}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/top-headlines/": {
"post": {
"summary": "Get Top Headlines",
"description": "Fetches top headlines for a given country, and optionally for a specific category.",
"operationId": "get_top_headlines_top_headlines__post",
"parameters": [
{
"name": "country",
"in": "query",
"required": true,
"schema": {
"type": "string",
"title": "Country"
}
},
{
"name": "category",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Category"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewsResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/top-headlines/sources": {
"post": {
"summary": "Get Sources",
"description": "Returns the subset of news publishers that top headlines are available from.",
"operationId": "get_sources_top_headlines_sources_post",
"parameters": [
{
"name": "category",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Category"
}
},
{
"name": "language",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Language"
}
},
{
"name": "country",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Country"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SourcesResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/search-articles/": {
"post": {
"summary": "Search Articles",
"description": "Searches through all articles based on a query.",
"operationId": "search_articles_search_articles__post",
"parameters": [
{
"name": "q",
"in": "query",
"required": false,
"schema": {
"type": "string",
"default": "openai",
"title": "Q"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewsResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/process_news_article": {
"post": {
"summary": "Process News Article",
"description": "Retrieves and processes the content of a news article.",
"operationId": "process_news_article_process_news_article_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewsURLData"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Processed article content",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/generate_bias_graph": {
"post": {
"summary": "Generate Bias Graph",
"description": "Generates a bias graph and returns the URL to the generated image.",
"operationId": "generate_bias_graph_generate_bias_graph_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BiasGraphData"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "URL of the Generated Bias Graph",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/generate_wordcloud": {
"post": {
"summary": "Generate Word Cloud",
"description": "Generates a word cloud and returns the URL to the generated image.",
"operationId": "generate_wordcloud_generate_wordcloud_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WordCloudData"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "URL of the Generated Word Cloud",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Article": {
"properties": {
"source": {
"allOf": [
{
"$ref": "#/components/schemas/ArticleSource"
}
],
"description": "The source information of the article."
},
"author": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Author",
"description": "The author of the article."
},
"title": {
"type": "string",
"title": "Title",
"description": "The title of the article."
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Description",
"description": "A brief description or summary of the article."
},
"url": {
"type": "string",
"maxLength": 2083,
"minLength": 1,
"format": "uri",
"title": "Url",
"description": "The URL to the full article."
},
"urlToImage": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Urltoimage",
"description": "The URL to an image associated with the article."
},
"publishedAt": {
"type": "string",
"title": "Publishedat",
"description": "The publication date and time in UTC."
},
"content": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Content",
"description": "The content of the article, truncated to 200 characters."
}
},
"type": "object",
"required": [
"source",
"title",
"url",
"publishedAt"
],
"title": "Article"
},
"ArticleSource": {
"properties": {
"id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Id",
"description": "The unique identifier of the news source."
},
"name": {
"type": "string",
"title": "Name",
"description": "The name of the news source."
}
},
"type": "object",
"required": [
"name"
],
"title": "ArticleSource"
},
"BiasGraphData": {
"properties": {
"left_right_bias": {
"type": "number",
"title": "Left Right Bias",
"description": "Bias on a left-right scale, where 0 is most left and 10 is most right.",
"example": 6
},
"positive_negative_bias": {
"type": "number",
"title": "Positive Negative Bias",
"description": "Bias on a positive-negative scale, where 0 is most negative and 10 is most positive.",
"example": 3
}
},
"type": "object",
"required": [
"left_right_bias",
"positive_negative_bias"
],
"title": "BiasGraphData"
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"NewsResponse": {
"properties": {
"status": {
"type": "string",
"title": "Status",
"description": "The status of the API response (e.g., 'ok' or 'error')."
},
"totalResults": {
"type": "integer",
"title": "Totalresults",
"description": "The total number of results available for the request."
},
"articles": {
"items": {
"$ref": "#/components/schemas/Article"
},
"type": "array",
"title": "Articles",
"description": "A list of articles matching the request."
}
},
"type": "object",
"required": [
"status",
"totalResults",
"articles"
],
"title": "NewsResponse"
},
"NewsURLData": {
"properties": {
"url": {
"type": "string",
"title": "Url",
"description": "The URL of the news article to process.",
"example": "https://example.com/news-article"
}
},
"type": "object",
"required": [
"url"
],
"title": "NewsURLData"
},
"Source": {
"properties": {
"id": {
"type": "string",
"title": "Id",
"description": "The identifier of the news source."
},
"name": {
"type": "string",
"title": "Name",
"description": "The name of the news source."
},
"description": {
"type": "string",
"title": "Description",
"description": "A description of the news source."
},
"url": {
"type": "string",
"maxLength": 2083,
"minLength": 1,
"format": "uri",
"title": "Url",
"description": "The URL of the homepage of the news source."
},
"category": {
"type": "string",
"title": "Category",
"description": "The type of news to expect from this news source."
},
"language": {
"type": "string",
"title": "Language",
"description": "The language that this news source writes in."
},
"country": {
"type": "string",
"title": "Country",
"description": "The country this news source is based in."
}
},
"type": "object",
"required": [
"id",
"name",
"description",
"url",
"category",
"language",
"country"
],
"title": "Source"
},
"SourcesResponse": {
"properties": {
"status": {
"type": "string",
"title": "Status",
"description": "The status of the API response (e.g., 'ok' or 'error')."
},
"sources": {
"items": {
"$ref": "#/components/schemas/Source"
},
"type": "array",
"title": "Sources",
"description": "A list of news sources."
}
},
"type": "object",
"required": [
"status",
"sources"
],
"title": "SourcesResponse"
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
},
"WordCloudData": {
"properties": {
"words": {
"items": {
"type": "string"
},
"type": "array",
"title": "Words",
"description": "A list of words, each word appears in the list as many times as it should be represented.",
"example": [
"news",
"news",
"news",
"news",
"news",
"analysis",
"analysis",
"analysis",
"analysis"
]
}
},
"type": "object",
"required": [
"words"
],
"title": "WordCloudData"
}
}
}
}