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.
Files changed (128) hide show
  1. package/.github/workflows/build-and-deploy.yml +44 -0
  2. package/.gitmodules +3 -0
  3. package/CLAUDE.md +92 -0
  4. package/README.md +0 -24
  5. package/add_types.sh +61 -0
  6. package/browserExtention/chrome/background.js +55 -0
  7. package/browserExtention/chrome/extention.json +1 -0
  8. package/browserExtention/chrome/liteplayer.js +26439 -0
  9. package/browserExtention/chrome/manifest.json +31 -0
  10. package/browserExtention/chrome/player-selector.js +1854 -0
  11. package/browserExtention/firefox/background.js +27 -0
  12. package/browserExtention/firefox/extention.json +1 -0
  13. package/browserExtention/firefox/liteplayer.js +26439 -0
  14. package/browserExtention/firefox/manifest.json +19 -0
  15. package/browserExtention/firefox/player-selector.js +1854 -0
  16. package/documents/.hugo_build.lock +0 -0
  17. package/documents/archetypes/default.md +5 -0
  18. package/documents/assets/jsconfig.json +11 -0
  19. package/documents/content/docs/install.md +103 -0
  20. package/documents/content/docs/quickstart.md +51 -0
  21. package/documents/content/docs/reference/HTML.md +31 -0
  22. package/documents/content/docs/reference/_index.md +10 -0
  23. package/documents/content/docs/reference/error_code.md +23 -0
  24. package/documents/content/docs/reference/iframe_api.md +737 -0
  25. package/documents/content/docs/reference/iframe_class.md +230 -0
  26. package/documents/content/docs/reference/multi_embed_player_class.md +113 -0
  27. package/documents/content/docs/reference/reserved_words.md +71 -0
  28. package/documents/content/docs/usage/GDPR_mode.md +77 -0
  29. package/documents/content/docs/usage/_index.md +10 -0
  30. package/documents/content/docs/usage/custom_playlist.md +239 -0
  31. package/documents/content/docs/usage/embed_api.md +163 -0
  32. package/documents/content/docs/usage/embed_various_service.md +81 -0
  33. package/documents/content/docs/usage/thumbnail_click.md +57 -0
  34. package/documents/go.mod +8 -0
  35. package/documents/go.sum +14 -0
  36. package/documents/hugo.toml +18 -0
  37. package/documents/layouts/partials/docs/sidebar.html +117 -0
  38. package/documents/layouts/partials/landing/features.html +47 -0
  39. package/documents/layouts/robots.txt +4 -0
  40. package/documents/static/_headers +7 -0
  41. package/documents/static/localStorageCheck.html +27 -0
  42. package/documents/static/no_extention.json +1 -0
  43. package/example.html +27 -0
  44. package/extention.json +1 -0
  45. package/icon/video_not_found.odg +0 -0
  46. package/icon/video_not_found.svgz +0 -0
  47. package/iframe_api/bilibili.ts +1095 -0
  48. package/iframe_api/niconico.ts +429 -0
  49. package/iframe_api/soundcloud.ts +450 -0
  50. package/iframe_api/youtube.ts +311 -0
  51. package/multi_embed_player.ts +989 -0
  52. package/package.json +10 -41
  53. package/player_api_gate/bilibili-api-gate/cgi/cpp/bilibili-api-gate-cgi.cpp +281 -0
  54. package/player_api_gate/bilibili-api-gate/cgi/go/src.go +46 -0
  55. package/player_api_gate/bilibili-api-gate/cloudflare_workers/package-lock.json +1356 -0
  56. package/player_api_gate/bilibili-api-gate/cloudflare_workers/package.json +12 -0
  57. package/player_api_gate/bilibili-api-gate/cloudflare_workers/src/index.js +50 -0
  58. package/player_api_gate/bilibili-api-gate/cloudflare_workers/wrangler.toml +3 -0
  59. package/player_api_gate/iframe-api-ts/.editorconfig +12 -0
  60. package/player_api_gate/iframe-api-ts/.prettierrc +6 -0
  61. package/player_api_gate/iframe-api-ts/package-lock.json +3054 -0
  62. package/player_api_gate/iframe-api-ts/package.json +18 -0
  63. package/player_api_gate/iframe-api-ts/src/bilibili.ts +49 -0
  64. package/player_api_gate/iframe-api-ts/src/index.ts +35 -0
  65. package/player_api_gate/iframe-api-ts/src/niconico.ts +95 -0
  66. package/player_api_gate/iframe-api-ts/src/soundcloud.ts +38 -0
  67. package/player_api_gate/iframe-api-ts/src/types.ts +115 -0
  68. package/player_api_gate/iframe-api-ts/src/url-proxy.ts +29 -0
  69. package/player_api_gate/iframe-api-ts/src/utils.ts +82 -0
  70. package/player_api_gate/iframe-api-ts/src/youtube.ts +41 -0
  71. package/player_api_gate/iframe-api-ts/test/bilibili.spec.ts +47 -0
  72. package/player_api_gate/iframe-api-ts/test/env.d.ts +3 -0
  73. package/player_api_gate/iframe-api-ts/test/index.spec.ts +59 -0
  74. package/player_api_gate/iframe-api-ts/test/niconico.spec.ts +55 -0
  75. package/player_api_gate/iframe-api-ts/test/soundcloud.spec.ts +55 -0
  76. package/player_api_gate/iframe-api-ts/test/tsconfig.json +8 -0
  77. package/player_api_gate/iframe-api-ts/test/url-proxy.spec.ts +46 -0
  78. package/player_api_gate/iframe-api-ts/test/youtube.spec.ts +45 -0
  79. package/player_api_gate/iframe-api-ts/tsconfig.json +45 -0
  80. package/player_api_gate/iframe-api-ts/vitest.config.mts +11 -0
  81. package/player_api_gate/iframe-api-ts/worker-configuration.d.ts +5768 -0
  82. package/player_api_gate/iframe-api-ts/wrangler.jsonc +47 -0
  83. package/player_api_gate/iframe_api/.editorconfig +13 -0
  84. package/player_api_gate/iframe_api/.prettierrc +6 -0
  85. package/player_api_gate/iframe_api/package-lock.json +1307 -0
  86. package/player_api_gate/iframe_api/package.json +12 -0
  87. package/player_api_gate/iframe_api/src/bilibili_api.js +60 -0
  88. package/player_api_gate/iframe_api/src/index.js +47 -0
  89. package/player_api_gate/iframe_api/src/niconico_api.js +112 -0
  90. package/player_api_gate/iframe_api/src/soundcloud_api.js +57 -0
  91. package/player_api_gate/iframe_api/src/url_proxy.js +28 -0
  92. package/player_api_gate/iframe_api/src/youtube_api.js +44 -0
  93. package/player_api_gate/iframe_api/wrangler.toml +51 -0
  94. package/player_api_gate/niconico-imager/cgi/go/src.go +74 -0
  95. package/player_api_gate/niconico-imager/cloudflare_workers/package-lock.json +2175 -0
  96. package/player_api_gate/niconico-imager/cloudflare_workers/package.json +12 -0
  97. package/player_api_gate/niconico-imager/cloudflare_workers/src/index.js +78 -0
  98. package/player_api_gate/niconico-imager/cloudflare_workers/wrangler.toml +3 -0
  99. package/test_script.html +172 -0
  100. package/tsconfig.json +36 -0
  101. package/dist/iframe_api/bilibili.d.ts +0 -91
  102. package/dist/iframe_api/bilibili.d.ts.map +0 -1
  103. package/dist/iframe_api/bilibili.js +0 -451
  104. package/dist/iframe_api/bilibili.js.map +0 -1
  105. package/dist/iframe_api/index.d.ts +0 -6
  106. package/dist/iframe_api/index.d.ts.map +0 -1
  107. package/dist/iframe_api/index.js +0 -8
  108. package/dist/iframe_api/index.js.map +0 -1
  109. package/dist/iframe_api/niconico.d.ts +0 -42
  110. package/dist/iframe_api/niconico.d.ts.map +0 -1
  111. package/dist/iframe_api/niconico.js +0 -181
  112. package/dist/iframe_api/niconico.js.map +0 -1
  113. package/dist/iframe_api/soundcloud.d.ts +0 -80
  114. package/dist/iframe_api/soundcloud.d.ts.map +0 -1
  115. package/dist/iframe_api/soundcloud.js +0 -188
  116. package/dist/iframe_api/soundcloud.js.map +0 -1
  117. package/dist/iframe_api/youtube.d.ts +0 -133
  118. package/dist/iframe_api/youtube.d.ts.map +0 -1
  119. package/dist/iframe_api/youtube.js +0 -278
  120. package/dist/iframe_api/youtube.js.map +0 -1
  121. package/dist/multi_embed_player.d.ts +0 -48
  122. package/dist/multi_embed_player.d.ts.map +0 -1
  123. package/dist/multi_embed_player.js +0 -318
  124. package/dist/multi_embed_player.js.map +0 -1
  125. package/dist/types.d.ts +0 -126
  126. package/dist/types.d.ts.map +0 -1
  127. package/dist/types.js +0 -22
  128. 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
@@ -0,0 +1,3 @@
1
+ [submodule "documents/themes/lotusdocs"]
2
+ path = documents/themes/lotusdocs
3
+ url = https://github.com/bonjinnorenka/lotusdocs.git
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}