# Live News
GET https://api.ydc-index.io/livenews
Reference: https://docs.you.com/api-reference/live-news/live-news
## OpenAPI Specification
```yaml
openapi: 3.1.1
info:
title: Returns a list of live news from query
version: endpoint_.returnsAListOfLiveNewsFromQuery
paths:
/livenews:
get:
operationId: returns-a-list-of-live-news-from-query
summary: Returns a list of live news from query
tags:
- []
parameters:
- name: q
in: query
description: >-
Retrieves responses from news media websites that are relevant to
the user's query.
**NOTE**: The You.com news API is currently available to
exclusive early access partners. To express interest in early
access, please reach out via email to
[api@you.com](mailto:api@you.com).
required: true
schema:
type: string
default: Your query about news
- name: count
in: query
description: Specifies the maximum number of news results to return.
required: false
schema:
type: integer
- name: X-API-Key
in: header
description: Header authentication of the form `undefined `
required: true
schema:
type: string
responses:
'200':
description: A JSON object containing news results.
content:
application/json:
schema:
$ref: >-
#/components/schemas/returnsAListOfLiveNewsFromQuery_Response_200
'401':
description: Unauthorized. Problems with API key.
content: {}
'403':
description: Forbidden. API key lacks scope for this path.
content: {}
'500':
description: >-
Internal Server Error during authentication/authorization
middleware.
content: {}
components:
schemas:
LivenewsGetResponsesContentApplicationJsonSchemaNewsQuery:
type: object
properties:
original:
type: string
description: Returns the original query submitted.
spellcheck_off:
type: boolean
default: false
LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetaUrl:
type: object
properties:
hostname:
type: string
description: The domain name of the URL.
netloc:
type: string
path:
type: string
description: The URL's path.
scheme:
type: string
LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsThumbnail:
type: object
properties:
src:
type: string
format: uri
LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetadata:
type: object
properties: {}
LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItems:
type: object
properties:
age:
type: string
description: How long ago the news was published.
description:
type: string
description: The publisher's description.
meta_url:
$ref: >-
#/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetaUrl
description: The URL's metadata.
page_age:
type: string
format: date-time
description: The timestamp of the publication date.
source_name:
type: string
description: The publisher's name.
thumbnail:
$ref: >-
#/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsThumbnail
description: The image's URI.
title:
type: string
description: The news article's title.
type:
type: string
url:
type: string
format: uri
metadata:
$ref: >-
#/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetadata
article_id:
type:
- string
- 'null'
LivenewsGetResponsesContentApplicationJsonSchemaNewsMetadata:
type: object
properties:
request_uuid:
type: string
format: uuid
LivenewsGetResponsesContentApplicationJsonSchemaNews:
type: object
properties:
query:
$ref: >-
#/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsQuery
results:
type: array
items:
$ref: >-
#/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItems
type:
type: string
metadata:
$ref: >-
#/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsMetadata
returnsAListOfLiveNewsFromQuery_Response_200:
type: object
properties:
news:
$ref: >-
#/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNews
```
## SDK Code Examples
```python
import requests
url = "https://api.ydc-index.io/livenews"
querystring = {"q":"Your query about news"}
headers = {"X-API-Key": ""}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
```
```javascript
const url = 'https://api.ydc-index.io/livenews?q=Your+query+about+news';
const options = {method: 'GET', headers: {'X-API-Key': ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
```
```go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ydc-index.io/livenews?q=Your+query+about+news"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
```
```java
HttpResponse response = Unirest.get("https://api.ydc-index.io/livenews?q=Your+query+about+news")
.header("X-API-Key", "")
.asString();
```
```csharp
var client = new RestClient("https://api.ydc-index.io/livenews?q=Your+query+about+news");
var request = new RestRequest(Method.GET);
request.AddHeader("X-API-Key", "");
IRestResponse response = client.Execute(request);
```
```swift
import Foundation
let headers = ["X-API-Key": ""]
let request = NSMutableURLRequest(url: NSURL(string: "https://api.ydc-index.io/livenews?q=Your+query+about+news")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
```