Restores "Sort by Upload Date" functionality to YouTube search using InnerTube API + optional YouTube Data API v3 fallback
Post-Launch News
04-18-2026 Ok, got another message with more specifics on what they changed to make it work:// ─── CONFIG ────────────────────────────────────────────────────────
const SETTINGS_KEY = 'yt_sort_date_settings';
const defaults = { apiKey: 'AIzaSy.....QsizIuRfho', engine: 'dataapi' }; // engine: 'innertube' | 'dataapi'
function getSettings() {
try { return Object.assign({}, defaults, JSON.parse(GM_getValue(SETTINGS_KEY, '{}'))); }
catch { return { ...defaults }; }
}
04-05-2026 Just got a private message today from someone who said they tried using a personal YouTube API Key and the script worked for them. Would be nice to hear from others if this works:
here is the relevant part of his translated message:
"What I should have done was modify the variables at the beginning: I added 'dataapi' and the key. It didn't work with the gear icon and save, but it did work this way."
03-08-2026 I've tested this script extensively on my setup, including incognito mode, to rule out conflicts with other extensions or scripts. It works flawlessly for me, but unfortunately others report failures. At this point, all I can do is keep it published... people can try it themselves and see if it works on their end.
YouTube Sort by Upload Date
YouTube removed the ability to easily sort search results by upload date. This userscript brings it back.
When you search for something on YouTube, you'll see a "Sort by Date" button appear near the search filters. Click it and your results will be re-sorted with the newest uploads first. Click it again to go back to YouTube's default ordering.
How it works
The script uses YouTube's own internal search API (InnerTube) to fetch results sorted by upload date - no setup required, it works right out of the box.
If you run into any issues with InnerTube, there's an optional fallback that uses the YouTube Data API v3. To use it, click the gear icon next to the Sort by Date button, select "YouTube Data API v3" as the engine, and paste in your API key. You can get a free key from Google Cloud Console (covers roughly 100 searches per day).
Features