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

Fix RegEx pattern for YouTube #256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Commits on Oct 5, 2020

  1. Update youtube.js

    When 
    `<a href="//youtu.be/WJ88GhJJI3Q?start=4394" data-lity>Link</a>`
    is fired, var matches in lity.js is filled as
    ```
    matche[0]: youtu.be/WJ88GhJJI3Q?start=4394
    matche[1]: youtu.be
    matche[2]: undefined
    matche[3]: undefined
    matche[4]: WJ88GhJJI3Q
    matche[5]: ?start=4394
    ```
    and then, lity builds a url below which includes `%3F` as an urlencoded result of `?` in `matche[5]` so that YouTube does not start the movie at 4394.
    `https://www.youtube.com/embed/WJ88GhJJI3Q?autoplay=1&%3Fstart=4394`
    
    So, 
    `var _youtubeRegex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i;`
    should be
    `var _youtubeRegex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})\?(.*)?/i;`
    for the expected behavior.
    nekoshippo authored Oct 5, 2020
    Configuration menu
    Copy the full SHA
    5df4d3f View commit details
    Browse the repository at this point in the history