Coder Social home page Coder Social logo

mikesteele / dual-captions Goto Github PK

View Code? Open in Web Editor NEW
228.0 10.0 40.0 82.28 MB

๐ŸŒ Subtitles in two languages for YouTube & Netflix

Home Page: https://chrome.google.com/webstore/detail/two-captions-for-youtube/lpeonmjfimoijceaalocpgjjchocbiap/related

License: MIT License

JavaScript 94.49% HTML 0.59% CSS 4.68% Shell 0.24%
chrome-extension youtube netflix kanopy

dual-captions's Introduction

This project is now archived (12/1/22)

When I created this project, it was just for myself to learn French on YouTube. I never imagined it would reach over 30,000 installs and over 200 stars. Thank you for your support over the years.

I cannot commit to maintaining this project going forward due to other priorities in my personal life. Thank you for understanding. The code will be kept up so that others can create and maintain forks if they choose to.

-- Mike

dual-captions
Subtitles in two languages for YouTube, Netflix, Disney+ & Kanopy

build


How does it work?

Site integrations

This extension works by intercepting caption file requests, parsing them, and rendering them onto the page.

The extension runs an adapter on the host site repeatedly to get up-to-date information about the state of the host. Adapters are functions that use DOM queries. You can find them in site_integrations.

This extension does not use any internal APIs on the host site (eg. window.netflix.appContext) and it does not change any of the host sites own code. (eg. manipulating the host site's video player bundle)

Why not?

  • It is fragile to inject code into the host site bundle.
  • It is fragile to rely on internal APIs that may change.
  • Adapters that only rely on DOM selectors allow us to fix host site changes quickly.
  • Tiny adapters allow for many websites to be supported.

The adapter API is still a work in progress and will be documented in the future.

This "hands off" approach has UX trade-offs, like requiring the user select a language on the host site to have the caption file requested. I believe long-term stability is more important than UX.

Saving settings across sessions

Since browser_actions cannot persist any data after they are closed, this extension uses Redux middleware to store the user's settings with chrome.storage on any change. When the popup is re-opened, the store is re-hydrated with the user's saved store settings, and settings are injected into the content_script.

Manual Installation

Building the extension locally requires having Node and Yarn installed. See https://nodejs.org/ and https://yarnpkg.com/ for installation steps.

  1. Build the extension
chmod u+x ./build-extension.sh
./build-extension.sh
  1. Load the /build/ directory as an unpacked extension in chrome://extensions

You'll need to enable Developer Mode in chrome://extensions to do this. See https://developer.chrome.com/extensions/getstarted#unpacked for more information.

Run Tests

cd browser_action
yarn test

cd content_script
yarn test

cd site_integrations
yarn test

Thanks

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.