code-charity / code-charity/youtube
💡Sort YouTube search results (client-side)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 4.6k
- Forks
- 996
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 7
Description
Problem
YouTube removed native sort-by-upload-date from search results (as of Jan 2026). Users now have no way to see newest videos first for a given search query. Feature requests in #3564, #3632 confirm this is a widely desired capability.
Solution
Add a client-side sort feature that reorders search result elements by upload date:
- Sort options: Upload date (newest first), Upload date (oldest first), Duration (shortest first), Duration (longest first), View count
- Uses YouTubes existing rendered data (date string, duration badge) to sort DOM elements
- Works with infinite scroll: re-sort new results as they load
- Toggleable from settings or via a sort picker on the search results page
Important caveat (client-side sorting)
Client-side DOM sorting is inherently limited:
- Only visible results are sorted -- cannot sort across pages
- New results loaded via infinite scroll require re-sorting
- Not as clean as server-side sorting would be
A server-side approach would require YouTube API key and OAuth. This feature should document the limitation clearly and offer both approaches if feasible.
Scope
Filtering and Discovery of Content
Parent
Split from #948 (filter search by duration). This is the client-side sort component.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the search-results DOM and the existing infinite-scroll handling, then review how settings or controls are added to the search results page. Done means visible results can be sorted by upload date, duration, and view count, newly loaded results are re-sorted, and the client-side visibility limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100