Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] API ignoring field parameter #4579

Closed
sean89503 opened this issue Apr 12, 2024 · 4 comments
Closed

[Bug] API ignoring field parameter #4579

sean89503 opened this issue Apr 12, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@sean89503
Copy link

sean89503 commented Apr 12, 2024

Describe the bug
When using the api it is stated in the doc it will support the fields API

Steps to Reproduce
in python

import` requests
from urllib.parse import parse_qs

# Define the API endpoint
api_endpoint = "https://invidious.us/api/v1/channels/UC8i8e7likh-EYMq1bZ0ttHw"

# Define the desired fields
desired_fields = ["fields", "author", "authorId"]

# Construct the query string
query_string = "&".join([f"{field}=" for field in desired_fields])

# Append the query string to the API endpoint
url = f"{api_endpoint}?{query_string}"

# Make the GET request
response = requests.get(url)

# Check if the request was successful (status code 200)
if response.status_code == 200:
    # Parse the JSON response
    data = response.json()
    # Print the relevant fields
    print("Author:", data.get("author"))
    print("ALL LOOKS:", data.get("authorId"))
else:
    print("Error:", response.status_code)

please change invidious.us as that's a redirect site
-->

Screenshots
image

@sean89503 sean89503 added the bug Something isn't working label Apr 12, 2024
@unixfox
Copy link
Member

unixfox commented Apr 12, 2024

fields feature were removed in #4276

doc is outdated :/ @SamantazFox

@unixfox unixfox closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2024
@absidue
Copy link
Contributor

absidue commented Apr 15, 2024

@unixfox There is already a PR open to update the docs, all you need to do is review it :)

@sean89503
Copy link
Author

is there a way to get only a few items, most of the info I want is in /api/v1/CHANNELS/videos but the description of the videos are cut off in /api/v1/CHANNELS/videos so I have to go to /api/v1/videos/video_id to get it but I have to download everything.

@SamantazFox
Copy link
Member

is there a way to get only a few items

@sean89503 We removed that fields feature because it was slowing down our API due to extra processing on the server side. Even if we only returned a single field, invidious had to parse the full data from Youtube, generate a full response, then drop the other fields.

In addition, the full response is small enough (~60kB or less than 10kB compressed) for it to not be a problem.

the description of the videos are cut off in /api/v1/CHANNELS/videos so I have to go to /api/v1/videos/video_id to get it but I have to download everything.

Blame Youtube for that. The full description is only available from the /api/v1/videos endpoint. All other places get a truncated (and un-formatted) version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants