multi_embed_player 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-and-deploy.yml +44 -0
- package/.gitmodules +3 -0
- package/CLAUDE.md +92 -0
- package/README.md +0 -24
- package/add_types.sh +61 -0
- package/browserExtention/chrome/background.js +55 -0
- package/browserExtention/chrome/extention.json +1 -0
- package/browserExtention/chrome/liteplayer.js +26439 -0
- package/browserExtention/chrome/manifest.json +31 -0
- package/browserExtention/chrome/player-selector.js +1854 -0
- package/browserExtention/firefox/background.js +27 -0
- package/browserExtention/firefox/extention.json +1 -0
- package/browserExtention/firefox/liteplayer.js +26439 -0
- package/browserExtention/firefox/manifest.json +19 -0
- package/browserExtention/firefox/player-selector.js +1854 -0
- package/documents/.hugo_build.lock +0 -0
- package/documents/archetypes/default.md +5 -0
- package/documents/assets/jsconfig.json +11 -0
- package/documents/content/docs/install.md +103 -0
- package/documents/content/docs/quickstart.md +51 -0
- package/documents/content/docs/reference/HTML.md +31 -0
- package/documents/content/docs/reference/_index.md +10 -0
- package/documents/content/docs/reference/error_code.md +23 -0
- package/documents/content/docs/reference/iframe_api.md +737 -0
- package/documents/content/docs/reference/iframe_class.md +230 -0
- package/documents/content/docs/reference/multi_embed_player_class.md +113 -0
- package/documents/content/docs/reference/reserved_words.md +71 -0
- package/documents/content/docs/usage/GDPR_mode.md +77 -0
- package/documents/content/docs/usage/_index.md +10 -0
- package/documents/content/docs/usage/custom_playlist.md +239 -0
- package/documents/content/docs/usage/embed_api.md +163 -0
- package/documents/content/docs/usage/embed_various_service.md +81 -0
- package/documents/content/docs/usage/thumbnail_click.md +57 -0
- package/documents/go.mod +8 -0
- package/documents/go.sum +14 -0
- package/documents/hugo.toml +18 -0
- package/documents/layouts/partials/docs/sidebar.html +117 -0
- package/documents/layouts/partials/landing/features.html +47 -0
- package/documents/layouts/robots.txt +4 -0
- package/documents/static/_headers +7 -0
- package/documents/static/localStorageCheck.html +27 -0
- package/documents/static/no_extention.json +1 -0
- package/example.html +27 -0
- package/extention.json +1 -0
- package/icon/video_not_found.odg +0 -0
- package/icon/video_not_found.svgz +0 -0
- package/iframe_api/bilibili.ts +1095 -0
- package/iframe_api/niconico.ts +429 -0
- package/iframe_api/soundcloud.ts +450 -0
- package/iframe_api/youtube.ts +311 -0
- package/multi_embed_player.ts +989 -0
- package/package.json +10 -41
- package/player_api_gate/bilibili-api-gate/cgi/cpp/bilibili-api-gate-cgi.cpp +281 -0
- package/player_api_gate/bilibili-api-gate/cgi/go/src.go +46 -0
- package/player_api_gate/bilibili-api-gate/cloudflare_workers/package-lock.json +1356 -0
- package/player_api_gate/bilibili-api-gate/cloudflare_workers/package.json +12 -0
- package/player_api_gate/bilibili-api-gate/cloudflare_workers/src/index.js +50 -0
- package/player_api_gate/bilibili-api-gate/cloudflare_workers/wrangler.toml +3 -0
- package/player_api_gate/iframe-api-ts/.editorconfig +12 -0
- package/player_api_gate/iframe-api-ts/.prettierrc +6 -0
- package/player_api_gate/iframe-api-ts/package-lock.json +3054 -0
- package/player_api_gate/iframe-api-ts/package.json +18 -0
- package/player_api_gate/iframe-api-ts/src/bilibili.ts +49 -0
- package/player_api_gate/iframe-api-ts/src/index.ts +35 -0
- package/player_api_gate/iframe-api-ts/src/niconico.ts +95 -0
- package/player_api_gate/iframe-api-ts/src/soundcloud.ts +38 -0
- package/player_api_gate/iframe-api-ts/src/types.ts +115 -0
- package/player_api_gate/iframe-api-ts/src/url-proxy.ts +29 -0
- package/player_api_gate/iframe-api-ts/src/utils.ts +82 -0
- package/player_api_gate/iframe-api-ts/src/youtube.ts +41 -0
- package/player_api_gate/iframe-api-ts/test/bilibili.spec.ts +47 -0
- package/player_api_gate/iframe-api-ts/test/env.d.ts +3 -0
- package/player_api_gate/iframe-api-ts/test/index.spec.ts +59 -0
- package/player_api_gate/iframe-api-ts/test/niconico.spec.ts +55 -0
- package/player_api_gate/iframe-api-ts/test/soundcloud.spec.ts +55 -0
- package/player_api_gate/iframe-api-ts/test/tsconfig.json +8 -0
- package/player_api_gate/iframe-api-ts/test/url-proxy.spec.ts +46 -0
- package/player_api_gate/iframe-api-ts/test/youtube.spec.ts +45 -0
- package/player_api_gate/iframe-api-ts/tsconfig.json +45 -0
- package/player_api_gate/iframe-api-ts/vitest.config.mts +11 -0
- package/player_api_gate/iframe-api-ts/worker-configuration.d.ts +5768 -0
- package/player_api_gate/iframe-api-ts/wrangler.jsonc +47 -0
- package/player_api_gate/iframe_api/.editorconfig +13 -0
- package/player_api_gate/iframe_api/.prettierrc +6 -0
- package/player_api_gate/iframe_api/package-lock.json +1307 -0
- package/player_api_gate/iframe_api/package.json +12 -0
- package/player_api_gate/iframe_api/src/bilibili_api.js +60 -0
- package/player_api_gate/iframe_api/src/index.js +47 -0
- package/player_api_gate/iframe_api/src/niconico_api.js +112 -0
- package/player_api_gate/iframe_api/src/soundcloud_api.js +57 -0
- package/player_api_gate/iframe_api/src/url_proxy.js +28 -0
- package/player_api_gate/iframe_api/src/youtube_api.js +44 -0
- package/player_api_gate/iframe_api/wrangler.toml +51 -0
- package/player_api_gate/niconico-imager/cgi/go/src.go +74 -0
- package/player_api_gate/niconico-imager/cloudflare_workers/package-lock.json +2175 -0
- package/player_api_gate/niconico-imager/cloudflare_workers/package.json +12 -0
- package/player_api_gate/niconico-imager/cloudflare_workers/src/index.js +78 -0
- package/player_api_gate/niconico-imager/cloudflare_workers/wrangler.toml +3 -0
- package/test_script.html +172 -0
- package/tsconfig.json +36 -0
- package/dist/iframe_api/bilibili.d.ts +0 -91
- package/dist/iframe_api/bilibili.d.ts.map +0 -1
- package/dist/iframe_api/bilibili.js +0 -451
- package/dist/iframe_api/bilibili.js.map +0 -1
- package/dist/iframe_api/index.d.ts +0 -6
- package/dist/iframe_api/index.d.ts.map +0 -1
- package/dist/iframe_api/index.js +0 -8
- package/dist/iframe_api/index.js.map +0 -1
- package/dist/iframe_api/niconico.d.ts +0 -42
- package/dist/iframe_api/niconico.d.ts.map +0 -1
- package/dist/iframe_api/niconico.js +0 -181
- package/dist/iframe_api/niconico.js.map +0 -1
- package/dist/iframe_api/soundcloud.d.ts +0 -80
- package/dist/iframe_api/soundcloud.d.ts.map +0 -1
- package/dist/iframe_api/soundcloud.js +0 -188
- package/dist/iframe_api/soundcloud.js.map +0 -1
- package/dist/iframe_api/youtube.d.ts +0 -133
- package/dist/iframe_api/youtube.d.ts.map +0 -1
- package/dist/iframe_api/youtube.js +0 -278
- package/dist/iframe_api/youtube.js.map +0 -1
- package/dist/multi_embed_player.d.ts +0 -48
- package/dist/multi_embed_player.d.ts.map +0 -1
- package/dist/multi_embed_player.js +0 -318
- package/dist/multi_embed_player.js.map +0 -1
- package/dist/types.d.ts +0 -126
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -22
- package/dist/types.js.map +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Build and Deploy TypeScript
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
tags:
|
|
7
|
+
- 'v*'
|
|
8
|
+
pull_request:
|
|
9
|
+
branches: [ main ]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build-and-deploy:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout repository
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
|
|
24
|
+
- name: Setup Node.js
|
|
25
|
+
uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: '22'
|
|
28
|
+
cache: 'npm'
|
|
29
|
+
registry-url: 'https://registry.npmjs.org'
|
|
30
|
+
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: npm ci
|
|
33
|
+
|
|
34
|
+
- name: Build TypeScript
|
|
35
|
+
run: npm run build
|
|
36
|
+
|
|
37
|
+
- name: Run tests (if any)
|
|
38
|
+
run: npm test --if-present
|
|
39
|
+
|
|
40
|
+
- name: Publish to npm
|
|
41
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
42
|
+
run: npm publish
|
|
43
|
+
env:
|
|
44
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.gitmodules
ADDED
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Development Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install dependencies
|
|
9
|
+
npm install
|
|
10
|
+
|
|
11
|
+
# Build TypeScript files to dist/
|
|
12
|
+
npm run build
|
|
13
|
+
|
|
14
|
+
# Development mode with file watching
|
|
15
|
+
npm run dev
|
|
16
|
+
|
|
17
|
+
# Lint TypeScript files
|
|
18
|
+
npm run lint
|
|
19
|
+
|
|
20
|
+
# Fix linting issues automatically
|
|
21
|
+
npm run lint:fix
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Architecture
|
|
25
|
+
|
|
26
|
+
This is a TypeScript multi-service video player library that supports:
|
|
27
|
+
- YouTube
|
|
28
|
+
- Bilibili
|
|
29
|
+
- SoundCloud
|
|
30
|
+
- Niconico
|
|
31
|
+
|
|
32
|
+
### Key Files Structure
|
|
33
|
+
|
|
34
|
+
- `multi_embed_player.ts` - Main player class and core functionality
|
|
35
|
+
- `types.ts` - Shared TypeScript type definitions
|
|
36
|
+
- `iframe_api/` - Service-specific iframe API implementations
|
|
37
|
+
- `youtube.ts`, `bilibili.ts`, `soundcloud.ts`, `niconico.ts`
|
|
38
|
+
- `index.ts` - Exports all player classes and types
|
|
39
|
+
- `dist/` - Compiled JavaScript output directory
|
|
40
|
+
- `player_api_gate/` - API gateway services (Cloudflare Workers)
|
|
41
|
+
- `browserExtention/` - Browser extension implementations
|
|
42
|
+
|
|
43
|
+
### Build System
|
|
44
|
+
|
|
45
|
+
- TypeScript compilation outputs to `dist/` directory
|
|
46
|
+
- Main entry point: `dist/multi_embed_player.js`
|
|
47
|
+
- Type definitions: `dist/multi_embed_player.d.ts`
|
|
48
|
+
- Source maps and declaration maps are generated
|
|
49
|
+
- Module system: ES2020 with Node.js resolution
|
|
50
|
+
|
|
51
|
+
### Development Workflow
|
|
52
|
+
|
|
53
|
+
Always run `npm run build` after TypeScript changes to update the compiled output. The library is published with the compiled JavaScript files, not the TypeScript source.
|
|
54
|
+
|
|
55
|
+
## TypeScript コンパイル時のクラス名保持について
|
|
56
|
+
|
|
57
|
+
TypeScript コンパイル時に `multi_embed_player.iframe_api_class[this.service]` が `_a.iframe_api_class[this.service]` になる問題への対処法:
|
|
58
|
+
|
|
59
|
+
### 問題
|
|
60
|
+
- `tsconfig.json` で `"module": "none"` 設定の場合、TypeScript コンパイラがクラス名を最小化
|
|
61
|
+
- `multi_embed_player` が `_a` に変換され、実行時にクラス参照が失われる
|
|
62
|
+
|
|
63
|
+
### 解決方法
|
|
64
|
+
1. グローバル変数へのクラス参照保存:
|
|
65
|
+
```typescript
|
|
66
|
+
// ファイル末尾に追加
|
|
67
|
+
(window as any).multi_embed_player = multi_embed_player;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
2. コード内でのグローバル参照使用:
|
|
71
|
+
```typescript
|
|
72
|
+
// 修正前
|
|
73
|
+
this.player = new multi_embed_player.iframe_api_class[this.service](...);
|
|
74
|
+
|
|
75
|
+
// 修正後
|
|
76
|
+
this.player = new (window as any).multi_embed_player.iframe_api_class[this.service](...);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. iframe_api_loader内でも同様に修正:
|
|
80
|
+
```typescript
|
|
81
|
+
// 修正前
|
|
82
|
+
multi_embed_player.iframe_api_class["youtube"] = mep_youtube;
|
|
83
|
+
|
|
84
|
+
// 修正後
|
|
85
|
+
(window as any).multi_embed_player.iframe_api_class["youtube"] = mep_youtube;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
これによりコンパイル後も `multi_embed_player.iframe_api_class` の形でクラス名が保持される。
|
|
89
|
+
|
|
90
|
+
## Memories
|
|
91
|
+
|
|
92
|
+
- moduleを使わないこと
|
package/README.md
CHANGED
|
@@ -7,30 +7,6 @@ support service list of multi embed player
|
|
|
7
7
|
- SoundCloud
|
|
8
8
|
- Niconico(**temporarily unavailable if your site not accepted by niconico**)
|
|
9
9
|
|
|
10
|
-
## TypeScript Support
|
|
11
|
-
|
|
12
|
-
This project has been migrated to TypeScript! 🎉
|
|
13
|
-
|
|
14
|
-
### Development
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
# Install dependencies
|
|
18
|
-
npm install
|
|
19
|
-
|
|
20
|
-
# Build TypeScript files
|
|
21
|
-
npm run build
|
|
22
|
-
|
|
23
|
-
# Watch mode for development
|
|
24
|
-
npm run dev
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Usage
|
|
28
|
-
|
|
29
|
-
The compiled JavaScript files are available in the `dist/` directory:
|
|
30
|
-
- Main player: `dist/multi_embed_player.js`
|
|
31
|
-
- Type definitions: `dist/multi_embed_player.d.ts`
|
|
32
|
-
- Individual iframe APIs: `dist/iframe_api/`
|
|
33
|
-
|
|
34
10
|
## Document and Demo Page
|
|
35
11
|
|
|
36
12
|
[https://multi-embed-player.pages.dev/docs/](https://multi-embed-player.pages.dev/docs/)
|
package/add_types.sh
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# iframe_api/bilibili.tsに型宣言を追加
|
|
4
|
+
sed -i '/class mep_bilibili{/a\
|
|
5
|
+
player: any;\
|
|
6
|
+
play_control_wrap: any;\
|
|
7
|
+
front_error_code: any;\
|
|
8
|
+
loading: any;\
|
|
9
|
+
before_mute_volume: any;\
|
|
10
|
+
content_width: any;\
|
|
11
|
+
content_height: any;\
|
|
12
|
+
videoid: any;\
|
|
13
|
+
original_replacing_element: any;\
|
|
14
|
+
player_set_event: any;\
|
|
15
|
+
seek_time: any;\
|
|
16
|
+
seek_time_used: any;\
|
|
17
|
+
noextention_count_stop: any;\
|
|
18
|
+
state: any;\
|
|
19
|
+
apicache: any;\
|
|
20
|
+
no_extention_pause: any;\
|
|
21
|
+
startSeconds: any;\
|
|
22
|
+
innerStartSeconds: any;\
|
|
23
|
+
autoplay_flag: any;\
|
|
24
|
+
displayCommentMode: any;\
|
|
25
|
+
fastload: any;\
|
|
26
|
+
no_extention_estimate_stop: any;\
|
|
27
|
+
play_start_time: any;\
|
|
28
|
+
play_start_count_interval: any;\
|
|
29
|
+
endSeconds: any;\
|
|
30
|
+
end_point_observe: any;\
|
|
31
|
+
custom_state: any;\
|
|
32
|
+
estimate_time: any;' iframe_api/bilibili.ts
|
|
33
|
+
|
|
34
|
+
# iframe_api/soundcloud.tsに型宣言を追加
|
|
35
|
+
sed -i '/class mep_soundcloud{/a\
|
|
36
|
+
player: any;\
|
|
37
|
+
playerVars: any;\
|
|
38
|
+
player_statusdata: any;\
|
|
39
|
+
autoplay: any;\
|
|
40
|
+
player_widget: any;\
|
|
41
|
+
player_metadata: any;\
|
|
42
|
+
before_mute_volume: any;\
|
|
43
|
+
forse_pause: any;\
|
|
44
|
+
first_seek_time: any;\
|
|
45
|
+
endSeconds: any;\
|
|
46
|
+
pause_sended: any;\
|
|
47
|
+
interval: any;\
|
|
48
|
+
previous_player_status: any;\
|
|
49
|
+
retry_count: any;' iframe_api/soundcloud.ts
|
|
50
|
+
|
|
51
|
+
# iframe_api/niconico.tsに型宣言を追加
|
|
52
|
+
sed -i '/class mep_niconico{/a\
|
|
53
|
+
state: any;\
|
|
54
|
+
startSeconds: any;\
|
|
55
|
+
player: any;\
|
|
56
|
+
playerId: any;\
|
|
57
|
+
autoplay_flag: any;\
|
|
58
|
+
endSeconds: any;\
|
|
59
|
+
displayCommentMode: any;' iframe_api/niconico.ts
|
|
60
|
+
|
|
61
|
+
echo "型宣言を追加しました"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var extention_json_url = chrome.runtime.getURL("extention.json");
|
|
2
|
+
var liteplayer_js_url = chrome.runtime.getURL("liteplayer.js");
|
|
3
|
+
var player_selector_js_url = chrome.runtime.getURL("player-selector.js");
|
|
4
|
+
|
|
5
|
+
chrome.declarativeNetRequest.updateDynamicRules(
|
|
6
|
+
{
|
|
7
|
+
removeRuleIds:[20,21,22],
|
|
8
|
+
addRules:[{
|
|
9
|
+
"id":20,
|
|
10
|
+
"action":{
|
|
11
|
+
"type":"redirect",
|
|
12
|
+
"redirect":{
|
|
13
|
+
"url":extention_json_url
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"condition":{
|
|
17
|
+
"urlFilter":"https://js.ryokuryu.com/multi_embed_player/no_extention.json",
|
|
18
|
+
"resourceTypes":[
|
|
19
|
+
"xmlhttprequest"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id":21,
|
|
25
|
+
"action":{
|
|
26
|
+
"type":"redirect",
|
|
27
|
+
"redirect":{
|
|
28
|
+
"url":liteplayer_js_url
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"condition":{
|
|
32
|
+
"urlFilter":"https://player.bilibili.com/main/html5/outer/liteplayer.min.js*",
|
|
33
|
+
"resourceTypes":[
|
|
34
|
+
"script"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id":22,
|
|
40
|
+
"action":{
|
|
41
|
+
"type":"redirect",
|
|
42
|
+
"redirect":{
|
|
43
|
+
"url":player_selector_js_url
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"condition":{
|
|
47
|
+
"urlFilter":"https://player.bilibili.com/tools/player-selector/player-selector.min.js*",
|
|
48
|
+
"resourceTypes":[
|
|
49
|
+
"script"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"extention_status":true}
|