-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Implement "fields" parameter from the YouTube Data API #429
Conversation
On the server side if there's an error with parsing |
Very nice, thank you! I left a couple comments, but otherwise this looks ready to merge 🎉 . If the error code is Usually only logger.write("MESSAGE\n") |
How are fields applied to arrays? For example, how would I retrieve {
"videoId": "CvFH_6DNRCY",
"videoThumbnails": [
{
"quality": "maxres",
"url": "https://invidio.us/vi/CvFH_6DNRCY/maxres.jpg",
"width": 1280,
"height": 720
},
{
"quality": "maxresdefault",
"url": "https://i.ytimg.com/vi/CvFH_6DNRCY/maxresdefault.jpg",
"width": 1280,
"height": 720
}
]
} Is this possible with the fields API? |
The log on YouTube API Example URL: Currently on Invidious it returns: {"error":"Expected Hash for #[]?(key : String), not Array(JSON::Any)"} The test URL being: http://0.0.0.0:3000/api/v1/comments/Kb3cwTfSOjw?fields=comments/author I wouldn't mind trying to implement it. |
Filtering inside arrays should now work 🎉 To get only
Getting multiple properties from an array is the same as a normal JSON object:
I also improved error messages. {"error":"Can't filter '/vi/CvFH_6DNRCY/maxres.jpg' by [\"invalid\"]"} It works fine as is, but I was wondering if I could simplify this part? I don't really understand why Thanks! |
Looks great! I suggested a couple changes, very excited to merge this. |
LGTM 👍 |
Allows filtering JSON responses from the Invidious API
For example, to only include the
title
andvideoId
from the JSON response, use:?fields=title,videoId
Asterisks/wildcards aren't supported as I didn't see the point.
To include all fields from an object, simply specify the entire object.
Reference: https://developers.google.com/youtube/v3/getting-started#fields