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

feat(bookmarklet): extract youtube track names from page #285

Merged
merged 15 commits into from
Mar 13, 2020

Conversation

adrienjoly
Copy link
Member

@adrienjoly adrienjoly commented Mar 12, 2020

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?

$ 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.

@adrienjoly adrienjoly changed the title refact: import YOUTUBE_PLAYER from Playem feat(bookmarklet): extract youtube track names from page Mar 12, 2020
@adrienjoly adrienjoly self-assigned this Mar 12, 2020
@adrienjoly adrienjoly added this to 📥 Inbox / ideas in Development via automation Mar 12, 2020
@adrienjoly adrienjoly moved this from 📥 Inbox / ideas to ⚙ In progress in Development Mar 12, 2020
@adrienjoly adrienjoly marked this pull request as ready for review March 13, 2020 10:37
@adrienjoly adrienjoly merged commit 9493f06 into master Mar 13, 2020
Development automation moved this from ⚙ In progress to ✔️ Done / pending QA Mar 13, 2020
@adrienjoly adrienjoly deleted the feat/262-fetch-youtube-track-names-from-page branch March 13, 2020 10:38
adrienjoly pushed a commit that referenced this pull request Mar 13, 2020
# [1.27.0](v1.26.4...v1.27.0) (2020-03-13)

### Features

* **bookmarklet:** extract youtube track names from page ([#285](#285)) ([9493f06](9493f06)), closes [#262](#262) [#281](#281) [#282](#282)
@adrienjoly adrienjoly moved this from ✔️ Done / pending QA to 🌲 In production in Development Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development
  
🌲 In production
Development

Successfully merging this pull request may close these issues.

None yet

1 participant