-
I'm using For reference, here's an example of the data response I'm working with: {
"kind": "youtube#channelListResponse",
"etag": "YyVLSZElWg6KtMt9F1EpHnxuOSY",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#channel",
"etag": "KT87bSs31ZNserxtiRcbIqVXkHo",
"id": "UCX6OQ3DkcsbYNE6H8uQQuVA",
"snippet": {
"title": "MrBeast",
"description": "SUBSCRIBE FOR A COOKIE!\n\nAccomplishments:\n- Raised $20,000,000 To Plant 20,000,000 Trees\n- Removed 30,000,000 pounds of trash from the ocean\n- Built wells in Africa\n- helped 1,000 blind people see\n- helped 1,000 deaf people hear\n- Given millions to charity\n- Started my own snack company Feastables\n- Donated over 100 cars lol\n- Gave away a private island (twice)\n- Gave away 1 million dollars in one video\n- Counted to 100k\n- Read the Dictionary\n- Read Bee Movie Script\n- Read Longest English Word\n- Watched Paint Dry\n- Ubering Across America\n- Watched It's Every Day Bro For 10 Hours\n- Ran a marathon in the world's largest shoes\n- Adopted every dog in a shelter\n- Bought $1,000,000 in lottery tickets\n- Sold houses for $1\n- I got buried alive\n- Recreated Squid Game in real life\n- Gave away a chocolate factory\n- Gave away private jet\n- Survived 50 hours in Antarctica\nYou get the point haha\n\n\n*Do not email me asking for money, I give away money because it makes me happy :)",
"customUrl": "@mrbeast",
"publishedAt": "2012-02-20T00:43:50Z",
"thumbnails": {
"default": {
"url": "https://yt3.ggpht.com/fxGKYucJAVme-Yz4fsdCroCFCrANWqw0ql4GYuvx8Uq4l_euNJHgE-w9MTkLQA805vWCi-kE0g=s88-c-k-c0x00ffffff-no-rj",
"width": 88,
"height": 88
},
"medium": {
"url": "https://yt3.ggpht.com/fxGKYucJAVme-Yz4fsdCroCFCrANWqw0ql4GYuvx8Uq4l_euNJHgE-w9MTkLQA805vWCi-kE0g=s240-c-k-c0x00ffffff-no-rj",
"width": 240,
"height": 240
},
"high": {
"url": "https://yt3.ggpht.com/fxGKYucJAVme-Yz4fsdCroCFCrANWqw0ql4GYuvx8Uq4l_euNJHgE-w9MTkLQA805vWCi-kE0g=s800-c-k-c0x00ffffff-no-rj",
"width": 800,
"height": 800
}
},
"defaultLanguage": "en",
"localized": {
"title": "MrBeast",
"description": "SUBSCRIBE FOR A COOKIE!\n\nAccomplishments:\n- Raised $20,000,000 To Plant 20,000,000 Trees\n- Removed 30,000,000 pounds of trash from the ocean\n- Built wells in Africa\n- helped 1,000 blind people see\n- helped 1,000 deaf people hear\n- Given millions to charity\n- Started my own snack company Feastables\n- Donated over 100 cars lol\n- Gave away a private island (twice)\n- Gave away 1 million dollars in one video\n- Counted to 100k\n- Read the Dictionary\n- Read Bee Movie Script\n- Read Longest English Word\n- Watched Paint Dry\n- Ubering Across America\n- Watched It's Every Day Bro For 10 Hours\n- Ran a marathon in the world's largest shoes\n- Adopted every dog in a shelter\n- Bought $1,000,000 in lottery tickets\n- Sold houses for $1\n- I got buried alive\n- Recreated Squid Game in real life\n- Gave away a chocolate factory\n- Gave away private jet\n- Survived 50 hours in Antarctica\nYou get the point haha\n\n\n*Do not email me asking for money, I give away money because it makes me happy :)"
},
"country": "US"
}
}
]
} I previously did this with
However, due to yq's increased flexibility for various data source types, I'm looking to replace My two questions are:
I can't rely on using the name 'high' being the element that I want, as it just depends on what resolutions are available. Instead, I can rely on the largest resolution being the last key. With Thanks for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
this ? yq '.items[].snippet.thumbnails | to_entries | sort_by(.value.height) | reverse | .0 | .value.url' |
Beta Was this translation helpful? Give feedback.
-
That did the trick! Thank you! |
Beta Was this translation helpful? Give feedback.
this ?
yq '.items[].snippet.thumbnails | to_entries | sort_by(.value.height) | reverse | .0 | .value.url'