Skip to content

Commit

Permalink
feat: 9anime.to support (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 authored Aug 2, 2022
1 parent efbd80e commit c2e73f5
Show file tree
Hide file tree
Showing 15 changed files with 5,983 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/utils/__tests__/urls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { cleanupUrl } from '../urls';
describe('URL Utils', () => {
describe('cleanupUrl', () => {
it.each([
['http://google.com', {}, 'http://google.com'],
['http://google.com', undefined, 'http://google.com'],
['http://google.com?key=value', {}, 'http://google.com'],
[
'http://google.com?key=value',
Expand Down
4 changes: 3 additions & 1 deletion packages/web-extension/src/@types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ type Service =
| 'funimation-2021-09-26'
| 'crunchyroll'
| 'crunchyroll-beta'
| 'zoro';
| 'zoro'
| '9anime';

type ServiceDisplayName =
| 'Anime Skip Test'
| 'VRV'
| 'Funimation'
| 'Crunchyroll'
| 'Zoro.to'
| '9anime'
| undefined;

type SupportedBrowser = 'firefox' | 'chrome';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum ParentHosts {
FUNIMATION_20210926 = 'https://www.funimation.com/v/*',
VRV = 'https://vrv.co/*',
ZORO = 'https://zoro.to/*',
NINE_ANIME = 'https://9anime.id/*',
}

/**
Expand All @@ -23,6 +24,7 @@ export enum PlayerHosts {
FUNIMATION_20210926 = 'https://www.funimation.com/v/*',
VRV = 'https://static.vrv.co/*',
ZORO = 'https://rapid-cloud.ru/*',
NINE_ANIME = 'https://vizcloud.site/*',
}

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/web-extension/src/common/utils/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ export function urlPatternMatch(
return false;
}
}

export function newlinesToSpaces(str: string): string {
return str.replace(/\s*\n\s*/g, ' ');
}
2 changes: 2 additions & 0 deletions packages/web-extension/src/content-scripts/parent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ParentHosts } from '~/common/utils/compile-time-constants';
import { error, loadedLog } from '~/common/utils/log';
import { urlPatternMatch } from '~/common/utils/strings';
import { initAnimeSkipParent } from './anime-skip';
import { init9animeParent } from './services/9anime/parent';
import { initCrunchyrollParent } from './services/crunchyroll/parent';
import { initFunimation20210926Parent } from './services/funimation-2021-09-26/parent';
import { initFunimationParent } from './services/funimation/parent';
Expand All @@ -19,6 +20,7 @@ const services: Record<ParentHosts, () => void> = {
[ParentHosts.TEST_SERVICE]: initTestServiceParent,
[ParentHosts.VRV]: initVrvParent,
[ParentHosts.ZORO]: initZoroParent,
[ParentHosts.NINE_ANIME]: init9animeParent,
};

function initParent() {
Expand Down
2 changes: 2 additions & 0 deletions packages/web-extension/src/content-scripts/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { error, loadedLog } from '~/common/utils/log';
import { urlPatternMatch } from '~/common/utils/strings';
import { IPlayerConfig } from '~types';
import { loadPlayerUi } from './player/index';
import { setup9animePlayer } from './services/9anime/player';
import { initCrunchyrollPlayer } from './services/crunchyroll/player';
import { initFunimation20210926Player } from './services/funimation-2021-09-26/player';
import { initFunimationPlayer } from './services/funimation/player';
Expand All @@ -17,6 +18,7 @@ const services: Record<PlayerHosts, () => IPlayerConfig> = {
[PlayerHosts.VRV]: initVrvPlayer,
[PlayerHosts.ZORO]: setupZoroPlayer,
[PlayerHosts.TEST_SERVICE]: initTestServicePlayer,
[PlayerHosts.NINE_ANIME]: setup9animePlayer,
};

function init() {
Expand Down
Loading

0 comments on commit c2e73f5

Please sign in to comment.