Giter VIP home page Giter VIP logo

synctube-qswitcher's Introduction

SyncTube-QSwitcher

Quality switcher plugin for SyncTube.

Installation

  • Create or edit user/res/js/custom.js file in SyncTube directory:

    'use strict';
    const JsApi = client.JsApi;
    JsApi.addPlugin('qswitcher');
  • Create user/res/plugins/ folder and navigate to it in terminal: cd user/res/plugins

  • git clone https://github.com/aNNiMON/SyncTube-QSwitcher.git qswitcher

How it works

  1. When a raw video starts playing, QSwitcher matches its url with a matcher regex ^(https?.*_)(${Q})p\.(mp4|webm|m3u8?)
  2. If the video is supported and url is matched, QSwitcher starts checks for other video links. To do this it replaces ${Q} with quality values defined in qualities: ['360', '480', '720', '1080'].
  • For example, if url is https://site.url/1b3720ac1080460c9_480p.mp4, it matches regex (https://site.url/1b3720ac1080460c9_)(480)p.(mp4)
  • Now the plugin starts checking qualities 360, 480, 720, 1080.
  • To do this it substitutes matched groups with $1${Q}p.$3: https://site.url/1b3720ac1080460c9_360p.mp4
  • So, these urls will be checked: https://site.url/video_360p.mp4, https://site.url/video_480p.mp4, https://site.url/video_720p.mp4 and https://site.url/video_1080p.mp4
  1. If there are two or more existing links, a switcher is created with these quality values.

TIP: you can remove some quality values if you want to reduce the number of requests.

Here is some other examples for matcher:

['^(https?.*_)(${Q})p\.(mp4|webm|m3u8?)', '$1${Q}p.$3']
// mathes https://site.url/1b3720ac1080460c9_480p.mp4

['^(https?.*\/)(${Q})(\/.*?\.)(mp4|webm|m3u8?)', '$1${Q}$3$4']
// matches https://site.url/videos/title/480/episode_1.m3u8

['^(https?.*\/)(${Q})(\/.*?_)(${Q})\.(mp4|webm|m3u8?)', '$1${Q}$3${Q}.$5']
// matches https://site.url/videos/title/480/episode_1_480.m3u

qualities: ['HD', 'FullHD', '4K'],
matcher: ['^(https?.*_)(${Q})\.(mp4|webm|m3u8?)', '$1${Q}.$3']
// matches https://site.url/episode_1_HD.mp4, https://site.url/episode_1_FullHD.mp4 and https://site.url/episode_1_4K.mp4

synctube-qswitcher's People

Contributors

annimon avatar

Watchers

 avatar

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.