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

MBS-11556: Standardise / clean up YouTube Music URLs #2494

Merged
merged 1 commit into from Dec 5, 2023

Conversation

reosarevok
Copy link
Member

Implement MBS-11556

As far as I can tell, YouTube Music uses mostly five kinds of URLs:

  1. watch (YouTube videos) for tracks
  2. playlist for releases (and also other playlists)
  3. channel for artists
  4. search for search
  5. browse for things like discography lists and, apparently, users' own videos and private stuff.

This supports watch for recording, playlist for release, channel for artist, and does not support browse or search links at all.
I didn't find label, series, etc channels, so I didn't touch those.
I added a new YouTube Music relationship for artists to avoid users having to check for each artist whether there's some paid content or all is free (which might anyway change later).
Label reltypes are not affected at all rn, meaning that streamingfree.label is technically still allowed. We could choose to use the restrict block here to "support" label and then reject the links, but I'm not sure that's useful, so I didn't now.

@reosarevok reosarevok added the New feature Non urgent new stuff label Apr 19, 2022
Copy link
Contributor

@yvanzo yvanzo left a comment

Choose a reason for hiding this comment

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

The mapping looks code, so does the code. I tested editing entities with some music.youtube.com URLs. Only the last error message doesn’t seem to match.

root/static/scripts/edit/URLCleanup.js Outdated Show resolved Hide resolved
As far as I can tell, YouTube Music uses mostly five kinds of URLs:
1) watch (YouTube videos) for tracks
2) playlist for releases (and also other playlists)
3) channel for artists
4) search for search
5) browse for things like discography lists and, apparently,
users' own videos and private stuff, plus as a redirect to /playlist.

This supports watch for recording, playlist for release, channel
for artist, and does not support browse or search links at all.
I didn't find label, series, etc channels, so I didn't touch those.
I added a new YouTube Music relationship for artists to avoid
users having to check for each artist whether there's some paid
content or all is free (which might anyway change later).
Label reltypes are not affected at all rn, meaning that
streamingfree.label is technically still allowed.
We could choose to use the restrict block here to "support" label and
then reject the links, but I'm not sure that's useful, so I didn't now.
@atj
Copy link
Contributor

atj commented Nov 29, 2023

@yvanzo: There's been a few requests about this functionality in Discord. Just a gentle nudge in case it has dropped off your radar. Thanks.

Copy link
Contributor

@yvanzo yvanzo left a comment

Choose a reason for hiding this comment

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

I did retest the counter-example. 💯 ⛵

@reosarevok reosarevok merged commit ae2c37b into metabrainz:master Dec 5, 2023
@reosarevok reosarevok deleted the MBS-11556 branch December 5, 2023 14:32
@tigerman325
Copy link

I'm not sure what this is going to do. But I want to add that YouTube Music is not free whereas regular YouTube is with commercials.

@yvanzo
Copy link
Contributor

yvanzo commented Dec 11, 2023

But I want to add that YouTube Music is not free whereas regular YouTube is with commercials.

Apparently some can be freely streamed but maybe not all. The PR allows for either or both. For examples, see the tests.

yvanzo added a commit that referenced this pull request Dec 12, 2023
* master:
  Update POT files using the production database
  Amend PR #3083: Fix ESLint max-len warning
  Amend e56e14a: Fix ESLint warning
  Add context to ’Edit’ messages
  Disambiguate tags in message context
  Add missing vote context
  Add numeration for cover art in message context
  Fix numeration in cover art message context
  Add missing context for cover art headers
  Uniformize ‘Merge’/‘Into’ message context
  Add context to messages about email address
  Add message context to all edit statuses
  Update ‘Update’ message context
  Use a single context for interactive UI elements
  Amend b8f9b01: Uniformize/simplify context message
  Amend 36544df: Uniformize/simplify context message
  Add "edit type" context to all edit types
  Add context to "open edits", "edit types", "edit note(s)"
  Use "edit type" over "edit name" for context
  Standardize strings outside of root/*/ and add context
  Standardize /work strings and add context
  Standardize /url strings and add context
  Standardize /taglookup strings and add context
  Standardize /tag strings and add context
  Standardize /statistics strings and add context
  Standardize /static strings and add context
  Standardize /series strings and add context
  Standardize /search strings and add context
  Standardize /report strings and add context
  Standardize /release_group strings and add context
  Standardize /release strings and add context
  Standardize /relationship strings and add context
  Standardize /recording strings and add context
  Standardize /place strings and add context
  Standardize /otherlookup strings and add context
  Standardize /oauth2 strings and add context
  Standardize /medium strings and add context
  Standardize /mbid strings and add context
  Standardize /main strings and add context
  Standardize /layout strings and add context
  Standardize /label strings and add context
  Standardize /instrument strings and add context
  Standardize /genre strings and add context
  Standardize /forms strings and add context
  Standardize /event strings and add context
  Standardize /entity strings and add context
  Standardize /doc strings and add context
  Standardize /components strings and add context
  Standardize /collection strings and add context
  Standardize /cdtoc strings and add context
  Standardize /cdstub strings and add context
  Standardize /artist_credit strings and add context
  Standardize /artist strings and add context
  Standardize /area strings and add context
  Standardize /edit strings and add context
  Standardize admin strings and add context
  Add utf8 to test using Unicode apostrophe.
  Standardize artist credit strings and add context
  Standardize user/account strings and add context
  Standardize user action messages and add context
  Standardize user type messages and add context
  Standardize "Add/edit/remove alias" messages and add context
  Standardize "Add/edit annotation" messages and add context
  Standardize "Edit entity" messages and add context
  Standardize "Remove entity" messages and add context
  Standardize cover art related strings
  Standardize menu headings
  Standardize "Add entity" messages and add context
  Add missing spaces before 'rw'
  Support CODE defaults in saves_preferences
  Simplify the preferences form display
  MBS-12560: Stop using track ID for recording ID URL (#2616)
  MBS-13139: Stay on the same page when going to MB.org (#2972)
  Apply changes from ae3f721 to commaList
  MBS-13365: Flatten commaOnlyList result
  MBS-13378: Add preference for note emails on abstain votes
  MBS-13377: Actually use email_on_vote preference
  MBS-13364: Always send note emails to edit author
  webpack/exec.mjs: log stdout, stderr if there's an error
  Add webpack/exec to exec webpack/exec.mjs
  Document React state management (#2815)
  Avoid using multiple with in Edit:: files (#2752)
  MBS-13397: Support video pages for jazzmusic/metalmusic/progarchives (#3118)
  Avoid using multiple with in Data:: files
  Use React$FragmentType rather than typeof React.Fragment (#3117)
  Fix quick links key warning (#3049)
  Use IDs rather than names for link types
  MBS-12324: Don't flag characters in ArtistsThatMayBePersons report
  Drop "catalogued" from ArtistsThatMayBePersons
  MBS-12323: Consider more person-only rels for ArtistsThatMayBePersons
  MBS-12318: Consider subgroup rels for ArtistsThatMayBe reports
  MBS-12725: Add "Refine this search" link on Votes by [user] page (#2756)
  MBS-12801: Warn users about "Disc n" titles on release merge (#2788)
  MBS-11556: Standardise / clean up YouTube Music URLs (#2494)
  Preserve some messages after commit 05960f8
  Move test to save build time (3× `git ls-files`)
  Drop unused and useless lp_admin
  Clean up before expanding admin-only messages
  MBS-13117: Drop message localization in admin pages
  Add tests for compareRelationships
  Declare phony targets in po/Makefile
  lint: Uniformize indent to tab in Makefiles
  Test in CI that admin pages avoid localization
  Use exp.l_admin in admin-only pages
  Use l_admin as appropriate in non-admin pages
  Add ((t)exp.)l[np]_admin for admin messages
  Skip extracting messages from non-module files
  Exclude admin files from source message extraction
  Follow Perl::Critic::Policy::Modules::RequireEndWithOne
  Follow Perl::Critic::Policy::Modules::ProhibitConditionalUseStatements
  Follow Perl::Critic::Policy::Modules::ProhibitAutomaticExportation
  Follow Perl::Critic::Policy::Modules::ProhibitModuleShebang
  Don't apply both Role::SelectAll and Role::OptionsTree
  Avoid using multiple with in Entity:: files (#2704)
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma
  Remove mostly unused Server::Release
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitEscapedCharacters
  Consistently use named constants for HTTP responses
  Remove duplicate use strict
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters
  Follow Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator
  Add Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitNullStatements
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyCommas
  Add a way to regenerate cpanfile.perl5.30.snapshot
  Fix focal image tag in Dockerfile.perl5.30.tests
  Bump musicbrainz-tests image versions
  Add Perl::Critic::Policy::CodeLayout::ProhibitIfIfSameLine
  Follow Perl::Critic::Policy::CodeLayout::RequireFinalSemicolon
  Follow Perl::Critic::Policy::CodeLayout::RequireTrailingCommaAtNewline
  Move EOF heredocs outside parens, indent it
  Add Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists
  Also block leading tabs with PerlCritic
  Document running Selenium tests that use search
  Fix ChromeDriver link
  Make _hash_to_row methods more consistent (#2729)
  Add missing metalmusicarchives favicon class
  MBS-13388: Handle vk.gy links
  MBS-13368: Properly compare series relationships if series is target
  MBS-12122: Add URL as edit search option
  MBS-12815: Support immutable URL edit search predicate
  Amend a57b065: Fix returning error 404 page
  Split deleting own account off to its own path
  MBS-13055: Search instrument attributes by alias
  MBS-13340: Case-insensitive instrument attribute search
  Replace global.js with globalThis
  Call export*TypeInfo in tests/relationship-editor.js
  Output Flow types in typeInfo.js
  Entity::Role::OptionsTree: Output description as non-null
  LinkTypeAttrTypeT (Flow): Add `typeID` property
  LinkTypeT (Flow): `examples` can be null
  Add Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless
  Follow Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA
  Add Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading
reosarevok added a commit that referenced this pull request Dec 18, 2023
* beta:
  Translated using Weblate (Italian)
  Translated using Weblate (Spanish)
  Update translation files
  Add missing lp import
  Update POT files using the production database
  Amend 8c57af5: Avoid translating more messages (#3125)
  Translated using Weblate (French)
  Translated using Weblate (Spanish)
  Update translation files
  Translated using Weblate (Lithuanian)
  Amend 9d257b7/3f0e317: Align with work edit form
  Amend ef90abd: Change letter-case in all occurrences
  Amend ef90abd: Change title in old template too
  Amend 926cea5: Change report’s title in index too
  Update POT files using the production database
  Translated using Weblate (Spanish)
  Translated using Weblate (Lithuanian)
  Translated using Weblate (French)
  Update translation files
  Translated using Weblate (Spanish)
  Add context to "Edit information"
  Remind about updating translations when releasing
  MBS-13404: Avoid duplicating feat. artists (#3123)
  Improve wording for a recently modified string
  Unify text about application’s callback URI
  Unify the text for possibly duplicate events
  Fix typo reported by Salo.Rock
  Add missing full stop to a recently udpated string
  Drop colon from recently added/modified messages
  Fix ending punctuation and typographic apostrophes
  Fix typo: Remove trailing space
  Unify the text for empty annotation
  Update POT files using the production database
  Uppercase MusicBrainz Database as a product name
  Lowercase and add context to "Delete Account"
  Lowercase forgotten CD Stub
  Also add 'edit status' context to JS list of statuses
  MBS-13117 (II): Make more admin strings untranslatable (#3120)
  Lowercase some more forgotten strings (#3121)
  Specify "plural" for series in preferences form
  Specify "data" quality in edit search
  Lowercase left behind "Attach Disc ID"
  Update translation files
  Update POT files using the production database
  Translated using Weblate (German)
  Update translation files
  Update POT files using the production database
  Amend PR #3083: Fix ESLint max-len warning
  Amend e56e14a: Fix ESLint warning
  Add context to ’Edit’ messages
  Disambiguate tags in message context
  Add missing vote context
  Add numeration for cover art in message context
  Fix numeration in cover art message context
  Add missing context for cover art headers
  Uniformize ‘Merge’/‘Into’ message context
  Add context to messages about email address
  Add message context to all edit statuses
  Update ‘Update’ message context
  Use a single context for interactive UI elements
  Amend b8f9b01: Uniformize/simplify context message
  Amend 36544df: Uniformize/simplify context message
  Add "edit type" context to all edit types
  Add context to "open edits", "edit types", "edit note(s)"
  Use "edit type" over "edit name" for context
  Standardize strings outside of root/*/ and add context
  Standardize /work strings and add context
  Standardize /url strings and add context
  Standardize /taglookup strings and add context
  Standardize /tag strings and add context
  Standardize /statistics strings and add context
  Standardize /static strings and add context
  Standardize /series strings and add context
  Standardize /search strings and add context
  Standardize /report strings and add context
  Standardize /release_group strings and add context
  Standardize /release strings and add context
  Standardize /relationship strings and add context
  Standardize /recording strings and add context
  Standardize /place strings and add context
  Standardize /otherlookup strings and add context
  Standardize /oauth2 strings and add context
  Standardize /medium strings and add context
  Standardize /mbid strings and add context
  Standardize /main strings and add context
  Standardize /layout strings and add context
  Standardize /label strings and add context
  Standardize /instrument strings and add context
  Standardize /genre strings and add context
  Standardize /forms strings and add context
  Standardize /event strings and add context
  Standardize /entity strings and add context
  Standardize /doc strings and add context
  Standardize /components strings and add context
  Standardize /collection strings and add context
  Standardize /cdtoc strings and add context
  Standardize /cdstub strings and add context
  Standardize /artist_credit strings and add context
  Standardize /artist strings and add context
  Standardize /area strings and add context
  Standardize /edit strings and add context
  Standardize admin strings and add context
  Add utf8 to test using Unicode apostrophe.
  Standardize artist credit strings and add context
  Standardize user/account strings and add context
  Standardize user action messages and add context
  Standardize user type messages and add context
  Standardize "Add/edit/remove alias" messages and add context
  Standardize "Add/edit annotation" messages and add context
  Standardize "Edit entity" messages and add context
  Standardize "Remove entity" messages and add context
  Standardize cover art related strings
  Standardize menu headings
  Standardize "Add entity" messages and add context
  Translated using Weblate (German)
  Translated using Weblate (German)
  Translated using Weblate (Chinese (Simplified))
  Translated using Weblate (Portuguese)
  Translated using Weblate (Lithuanian)
  Add missing spaces before 'rw'
  Support CODE defaults in saves_preferences
  Simplify the preferences form display
  MBS-12560: Stop using track ID for recording ID URL (#2616)
  MBS-13139: Stay on the same page when going to MB.org (#2972)
  Apply changes from ae3f721 to commaList
  MBS-13365: Flatten commaOnlyList result
  MBS-13378: Add preference for note emails on abstain votes
  MBS-13377: Actually use email_on_vote preference
  MBS-13364: Always send note emails to edit author
  webpack/exec.mjs: log stdout, stderr if there's an error
  Add webpack/exec to exec webpack/exec.mjs
  Document React state management (#2815)
  Avoid using multiple with in Edit:: files (#2752)
  MBS-13397: Support video pages for jazzmusic/metalmusic/progarchives (#3118)
  Avoid using multiple with in Data:: files
  Use React$FragmentType rather than typeof React.Fragment (#3117)
  Fix quick links key warning (#3049)
  Use IDs rather than names for link types
  MBS-12324: Don't flag characters in ArtistsThatMayBePersons report
  Drop "catalogued" from ArtistsThatMayBePersons
  MBS-12323: Consider more person-only rels for ArtistsThatMayBePersons
  MBS-12318: Consider subgroup rels for ArtistsThatMayBe reports
  MBS-12725: Add "Refine this search" link on Votes by [user] page (#2756)
  MBS-12801: Warn users about "Disc n" titles on release merge (#2788)
  MBS-11556: Standardise / clean up YouTube Music URLs (#2494)
  Preserve some messages after commit 05960f8
  MBS-13393: Reduce the relationship data stored in sessionStorage
  Remove undefined properties from external links editor state
  MBS-13392: Restore external links editor submission upon form reload
  Move test to save build time (3× `git ls-files`)
  Drop unused and useless lp_admin
  Clean up before expanding admin-only messages
  MBS-13117: Drop message localization in admin pages
  Add tests for compareRelationships
  Declare phony targets in po/Makefile
  lint: Uniformize indent to tab in Makefiles
  Test in CI that admin pages avoid localization
  Use exp.l_admin in admin-only pages
  Use l_admin as appropriate in non-admin pages
  Add ((t)exp.)l[np]_admin for admin messages
  Skip extracting messages from non-module files
  Exclude admin files from source message extraction
  Follow Perl::Critic::Policy::Modules::RequireEndWithOne
  Follow Perl::Critic::Policy::Modules::ProhibitConditionalUseStatements
  Follow Perl::Critic::Policy::Modules::ProhibitAutomaticExportation
  Follow Perl::Critic::Policy::Modules::ProhibitModuleShebang
  Don't apply both Role::SelectAll and Role::OptionsTree
  Avoid using multiple with in Entity:: files (#2704)
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma
  Remove mostly unused Server::Release
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitEscapedCharacters
  Consistently use named constants for HTTP responses
  Remove duplicate use strict
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters
  Follow Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator
  Add Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitNullStatements
  Follow Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyCommas
  Add a way to regenerate cpanfile.perl5.30.snapshot
  Fix focal image tag in Dockerfile.perl5.30.tests
  Bump musicbrainz-tests image versions
  Add Perl::Critic::Policy::CodeLayout::ProhibitIfIfSameLine
  Follow Perl::Critic::Policy::CodeLayout::RequireFinalSemicolon
  Follow Perl::Critic::Policy::CodeLayout::RequireTrailingCommaAtNewline
  Move EOF heredocs outside parens, indent it
  Add Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists
  Also block leading tabs with PerlCritic
  Document running Selenium tests that use search
  Fix ChromeDriver link
  Make _hash_to_row methods more consistent (#2729)
  Make all form/field types read-only
  Update mutate-cow to v5
  Add missing metalmusicarchives favicon class
  MBS-13388: Handle vk.gy links
  MBS-13368: Properly compare series relationships if series is target
  MBS-12122: Add URL as edit search option
  MBS-12815: Support immutable URL edit search predicate
  Amend a57b065: Fix returning error 404 page
  Split deleting own account off to its own path
  MBS-13055: Search instrument attributes by alias
  MBS-13340: Case-insensitive instrument attribute search
  Replace global.js with globalThis
  Call export*TypeInfo in tests/relationship-editor.js
  Output Flow types in typeInfo.js
  Entity::Role::OptionsTree: Output description as non-null
  LinkTypeAttrTypeT (Flow): Add `typeID` property
  LinkTypeT (Flow): `examples` can be null
  Add Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless
  Follow Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA
  Add Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New feature Non urgent new stuff URL handling
Projects
None yet
4 participants