-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bookmarklet): extract youtube track names from page (#285)
Contributes to #262. Follow up of #281 and #282. ## What does this PR do / solve? After YouTube reduced our API quota, we resorted to specifying "(YouTube track)" as the title of tracked extracted from YouTube pages using the bookmarklet, in order to save some quota. This PR intends to determine the actual name of the track by extracting text from the DOM, and therefore to get rid of those "(YouTube track)" titles on newly added tracks. ## Overview of changes - completely get rid of forced "(YouTube track)" titles 🥳 - add feat: "return a track with metadata from a YouTube page that lists that track as a link" - add feat: "return a track with the expected name when that track was found as a link from a YouTube page" (i.e. remove noise from title) - add feat: "return the page's track with metadata from a YouTube page when the same track is also listed in the page with less metadata" - rename `detectPlayemStreams()` --> `detectPlayableStreams()` + integrate `YOUTUBE_PLAYER` (partially imported from PlayemJS, without the API query part) in the bookmarket, and use it also from tests => first step in progressively getting rid of Playem for track detection - normalize the way text is extracted from DOM - cleaning up logs from bookmarklet - simplify logic and make code a little bit more readable overall ## How to test this PR? ```sh $ nvm use $ node_modules/.bin/mocha test/unit/bookmarklet-tests.js $ docker-compose up --build -d $ npm run docker:seed && node_modules/.bin/wdio wdio.conf.js ``` Also, you can test the bookmarklet manually, from your web browser, by following the instructions provided in the unit test file.
- Loading branch information
1 parent
eb4d8e3
commit 9493f06
Showing
2 changed files
with
183 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.