This repository has been archived on 2026-05-27. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
rustypipe/notes/dictionary.md
ThetaDev bb396968dc tests: completed for all languages
fix: parsing search videos without duration
2023-05-05 15:18:37 +02:00

1 KiB

Parsing localized data from YouTube

Since YouTube's API is outputting the website as it should be rendered by the client, the data received from the API is already localized. This affects dates, times and number formats.

To be able to successfully parse them, we need to collect samples in every language and build a dictionary.

Timeago

  • Relative date format used for video upload dates and comments.
  • Examples: "1 hour ago", "3 months ago"

Playlist dates

  • Playlist update dates are always day-accurate, either as textual dates or in the form of "n days ago"
  • Examples: "Last updated on Jan 3, 2020", "Updated today", "Updated yesterday", "Updated 3 days ago"

Video duration

  • In Danisch ("da") video durations are formatted using dots instead of colons. Example: "12.31", "3.03.52"

Numbers

  • Large numbers (subscriber/view counts) are rounded and shown using a decimal prefix
  • Examples: "1.4M views"
  • There is an exception for the value 0 ("no views") and in some languages for the value 1 (pt: "Um vídeo")