Skip to content
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

Add a script to update the region/geolocation files #3701

Merged
merged 4 commits into from
Jul 1, 2023

Conversation

absidue
Copy link
Member

@absidue absidue commented Jun 25, 2023

Add a script to update the region/geolocation files

Pull Request Type

  • Bugfix
  • Feature Implementation

Related issue

close #3441

Description

Currently FreeTube lists a bunch geolocations for trending that YouTube doesn't support and is also missing some that YouTube does support, this is because the locations were taken from a repository that had location information translated into various different languages.

This pull request adds a script that extracts the geolocations from YouTube in as many of the active languages in FreeTube as possible, that way we have an accurate list and also have them translated into various different languages.

For some languages I've added manual mappings, like French which is fr-FR in FreeTube but fr on YouTube.

The script currently only collects geolocation translations for whitelisted/active languages in FreeTube, it doesn't for any of the other languages.

Here is the script output:

yarn get-regions
yarn run v1.22.19
$ node _scripts/getRegions.mjs
Active FreeTube languages that aren't available on YouTube:
[ 'es-MX', 'es_AR', 'he', 'pt-BR' ]
YouTube languages that don't have an equivalent active FreeTube language:
[
  'af',     'am',    'as',    'az',
  'be',     'bn',    'bs',    'en-IN',
  'es-419', 'es-US', 'fa',    'fil',
  'fr-CA',  'gu',    'hi',    'hy',
  'iw',     'ka',    'kk',    'km',
  'kn',     'ky',    'lo',    'lv',
  'mk',     'ml',    'mn',    'mr',
  'ms',     'my',    'ne',    'or',
  'pa',     'si',    'sq',    'sr-Latn',
  'sw',     'ta',    'te',    'th',
  'ur',     'uz',    'zh-HK', 'zu'
]
Done in 2.70s.

Screenshots

three-dots-menu

Testing

Test trending with various locations, none of them should error like they did before.

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 25, 2023 21:28
@github-actions github-actions bot added PR: dependencies Pull requests that update a dependency file PR: waiting for review For PRs that are complete, tested, and ready for review labels Jun 25, 2023
@PikachuEXE
Copy link
Collaborator

What do you mean by "Test trending with various locations" ?_?
On of the options in settings? (I haven't used that part ever)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Messaging should be changed.

Capture

Not sure if we need to do anything about this but if u select some languages the alphabetic order of the list gets a bit messed up.

VirtualBoxVM_CtQbk8SbMw.mp4
VirtualBoxVM_g0iU9pMSu1.mp4

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Jun 27, 2023
@absidue
Copy link
Member Author

absidue commented Jun 30, 2023

Added language sensitive sorting, the only language that changed was de-DE, I even intentionally changed the order of the cs language but it went back to putting Chile after Hong Kong, so in the first video the sorting seems to be correct.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@absidue absidue added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: changes requested labels Jun 30, 2023
@absidue
Copy link
Member Author

absidue commented Jun 30, 2023

Removed the extra sentence and added sorting for the languages, any that looks incorrectly sorted now, is correct unless the standard javascript Intl.Collator API is broken, which i highly doubt.

@FreeTubeBot FreeTubeBot merged commit 9393523 into FreeTubeApp:development Jul 1, 2023
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 1, 2023
@absidue absidue deleted the geolocations-script branch July 1, 2023 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Region for trending list contains regions that doesnt exist on YT side
5 participants