Skip to content

fix(nicojk): iOSで動かしたときのリダイレクト周りの考慮 - #34

Merged
ci7lus merged 3 commits into
mainfrom
fix/ios-redirect
Aug 26, 2026
Merged

ci7lus merged 3 commits into
mainfrom
fix/ios-redirect

Conversation

@ci7lus

@ci7lus ci7lus commented Aug 26, 2026 •

Copy link
Copy Markdown
Owner

Sourceryによる概要

NicoNico iOSの視聴ページのリダイレクトに対応し、プラグインのオプションでバンドルされた依存関係のライセンスを表示できるようにしました。

新機能:

  • 生成された依存関係のライセンス情報を、サンプルおよびNicoJKプラグインのオプション画面に表示。

バグ修正:

  • モバイル用ホスト名、初期状態データ、ミリ秒単位のタイムスタンプ、数値HTMLエンティティを含むNicoNico iOSの視聴ページの解析に対応。

ビルド:

  • 依存関係のライセンス情報を含むLICENSES.mdファイルを生成するようビルドを設定。

ドキュメント:

  • リポジトリのビルドおよびパッケージ認証に関するガイダンスを更新。

テスト:

  • NicoNicoモバイルURLおよびiOSの初期状態データ抽出のテストカバレッジを追加。
Original summary in English

Sourceryによる概要

NicoNico iOSの視聴ページのリダイレクトに対応し、プラグインのオプションで同梱依存関係のライセンスを表示できるようにしました。

新機能:

  • exampleおよびNicoJKプラグインのオプションページに、同梱依存関係のライセンス情報を表示。

バグ修正:

  • モバイル用ホスト名、初期状態データ、ミリ秒単位のタイムスタンプ、数値HTMLエンティティを含む、NicoNico iOS/モバイル視聴ページの解析に対応。

ビルド:

  • ビルド時に依存関係のライセンス情報を含むLICENSES.mdファイルを生成。

ドキュメント:

  • ビルドおよびパッケージ認証に関するガイダンスを更新。

テスト:

  • NicoNicoモバイルURLおよびiOSの初期状態データ抽出のカバレッジを追加。
Original summary in English

Sourceryによる概要

NicoNico iOS視聴ページのリダイレクトに対応し、プラグインオプションでバンドルされた依存関係のライセンス情報を表示できるようにしました。

新機能:

  • exampleおよびNicoJKプラグインのオプションページに、バンドルされた依存関係のライセンス情報を表示。

バグ修正:

  • リダイレクトされたホスト名、初期状態データ、ミリ秒単位のタイムスタンプ、数値HTMLエンティティを含む、NicoNicoモバイル/iOS視聴ページの解析に対応。

ビルド:

  • ビルド中に依存関係のライセンス情報を含むLICENSES.mdファイルを生成。

ドキュメント:

  • ビルドおよびパッケージ認証に関するガイダンスを更新。

テスト:

  • NicoNicoモバイルURLおよびiOSの初期状態抽出に関するテストカバレッジを追加。
Original summary in English

Sourceryによる概要

NicoNicoモバイル版およびiOS版の視聴ページへのリダイレクトに対応し、プラグインオプションでバンドルされた依存関係のライセンス情報を公開します。

新機能:

  • exampleおよびNicoJKプラグインのオプションページに、バンドルされた依存関係のライセンス情報を表示。

バグ修正:

  • 別のホスト名、初期状態データ、ミリ秒単位のタイムスタンプ、数値HTMLエンティティを含む、リダイレクトされたNicoNicoモバイル版/iOS版の視聴ページの解析に対応。

ビルド:

  • ビルド時に依存関係のライセンス情報を含むLICENSES.mdファイルを生成。

ドキュメント:

  • ビルドおよびGitHub Packagesの認証に関するガイダンスを更新。

テスト:

  • NicoNicoモバイル版URLおよびiOS版の初期状態データ抽出のテストカバレッジを追加。
Original summary in English

Summary by Sourcery

Support NicoNico mobile and iOS watch-page redirects and expose bundled dependency licenses in plugin options.

New Features:

  • Display bundled dependency license information in the example and NicoJK plugin options pages.

Bug Fixes:

  • Support parsing redirected NicoNico mobile/iOS watch pages, including alternate hostnames, initial-state data, millisecond timestamps, and numeric HTML entities.

Build:

  • Generate a LICENSES.md file containing dependency license information during builds.

Documentation:

  • Update build and GitHub Packages authentication guidance.

Tests:

  • Add coverage for NicoNico mobile URLs and iOS initial-state data extraction.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @ci7lus, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 17 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown

レビュアーガイド

このPRでは、生成されたライセンス開示UIを追加し、NicoNicoの視聴ページ解析を拡張しています。iOSからsp.live.nicovideo.jpへリダイレクトされるケース、初期状態のペイロード、ミリ秒単位のタイムスタンプ、数値HTMLエンティティに対応し、集中的なパーサーテストとビルド/認証手順の更新も行っています。

iOS版NicoNico視聴ページ解析のフロー図

flowchart TD
    Start[parseNiconicoWatchPageHtml] --> Extract[extractEmbeddedDataProps]
    Extract --> Payload{embedded-data or initial-state}
    Payload --> Fields[Read program, vposBaseTime, and WebSocket URL]
    Fields --> Fallback[Use pageContents.watchInformation when desktop fields are absent]
    Fallback --> URL[parseFinalUrl accepts live.nicovideo.jp or sp.live.nicovideo.jp]
    URL --> Time[normalizeVposBaseTime converts millisecond timestamps]
    Time --> Result[Return normalized watch-page data]
Loading

ファイル単位の変更

変更内容 詳細 ファイル
プラグインオプション画面に、ビルド時に生成されるライセンス通知を追加。
  • 生成されたLICENSES.mdを取得して表示し、読み込み中、エラー、中止、スクロール可能なコンテンツの各状態に対応。
  • Vite/Rollupを設定してLICENSES.mdを出力し、exampleおよびNicoNicoのオプション画面に通知をマウント。
src/components/LicenseNotice.tsx
src/plugins/example/App.tsx
src/plugins/nicojk/components/OptionsPage.tsx
vite.config.ts
iOS/モバイル版NicoNicoの視聴ページにおけるリダイレクトとペイロード形式に対応。
  • sp.live.nicovideo.jpの視聴URLを受け付け、embedded-dataからinitial-stateへのフォールバックに対応。
  • モバイルページのpageContents構造から、番組ID、vposの基準時刻、WebSocket URLを読み取り。
  • ミリ秒単位のタイムスタンプを正規化し、より広範な数値HTMLエンティティをデコード。
src/plugins/nicojk/niconico-watch-page.ts
tests/nicojk-watch-page.test.ts
リポジトリのビルドおよびパッケージ認証の手順と、生成されたプラグインメタデータを更新。
  • direnvを使用したローカルビルドについて記載し、GitHub Packagesの認証情報をユーザーのnpm設定に保持。
  • プラグインマニフェストのメタデータを更新。
.npmrc
AGENTS.md
scripts/plugins-manifest.json
src/plugins/nicojk/agents.md

ヒントとコマンド

Sourceryとのやり取り

  • 新しいレビューを開始: プルリクエストに@sourcery-ai reviewとコメントします。
  • ディスカッションを続ける: Sourceryのレビューコメントに直接返信します。
  • レビューコメントからGitHub Issueを作成: レビューコメントに返信して、SourceryにIssueの作成を依頼します。レビューコメントに@sourcery-ai issueと返信してIssueを作成することもできます。
  • プルリクエストのタイトルを生成: プルリクエストのタイトル内の任意の場所に@sourcery-aiと記述すると、いつでもタイトルを生成できます。プルリクエストに@sourcery-ai titleとコメントして、いつでもタイトルを生成または再生成することもできます。
  • プルリクエストの概要を生成: プルリクエスト本文内の任意の場所に@sourcery-ai summaryと記述すると、指定した位置にPRの概要をいつでも生成できます。プルリクエストに@sourcery-ai summaryとコメントして、いつでも概要を生成または再生成することもできます。
  • レビュアーガイドを生成: プルリクエストに@sourcery-ai guideとコメントすると、レビュアーガイドをいつでも生成または再生成できます。
  • Sourceryのコメントをすべて解決: プルリクエストに@sourcery-ai resolveとコメントすると、Sourceryのコメントをすべて解決できます。すべてのコメントへの対応が完了し、これ以上表示したくない場合に便利です。
  • Sourceryのレビューをすべて却下: プルリクエストに@sourcery-ai dismissとコメントすると、既存のSourceryレビューをすべて却下できます。新しいレビューを最初から始めたい場合に特に便利です。その場合は、@sourcery-ai reviewとコメントして新しいレビューを開始することを忘れないでください。

利用環境のカスタマイズ

ダッシュボードにアクセスして、次の操作を行えます。

  • Sourceryが生成するプルリクエスト概要、レビュアーガイドなどのレビュー機能を有効化または無効化。
  • レビュー言語を変更。
  • カスタムレビュー指示を追加、削除、編集。
  • その他のレビュー設定を調整。

ヘルプの利用

Original review guide in English

Reviewer's Guide

This PR adds a generated license disclosure UI and extends NicoNico watch-page parsing to handle iOS redirects to sp.live.nicovideo.jp, initial-state payloads, millisecond timestamps, and numeric HTML entities, with focused parser tests and updated build/authentication guidance.

Flow diagram for iOS NicoNico watch-page parsing

flowchart TD
    Start[parseNiconicoWatchPageHtml] --> Extract[extractEmbeddedDataProps]
    Extract --> Payload{embedded-data or initial-state}
    Payload --> Fields[Read program, vposBaseTime, and WebSocket URL]
    Fields --> Fallback[Use pageContents.watchInformation when desktop fields are absent]
    Fallback --> URL[parseFinalUrl accepts live.nicovideo.jp or sp.live.nicovideo.jp]
    URL --> Time[normalizeVposBaseTime converts millisecond timestamps]
    Time --> Result[Return normalized watch-page data]
Loading

File-Level Changes

Change Details Files
Add a build-generated license notice to plugin options screens.
  • Fetch and display the generated LICENSES.md with loading, error, abort, and scrollable-content states.
  • Configure Vite/Rollup to emit LICENSES.md and mount the notice in the example and NicoNico options views.
src/components/LicenseNotice.tsx
src/plugins/example/App.tsx
src/plugins/nicojk/components/OptionsPage.tsx
vite.config.ts
Support iOS/mobile NicoNico watch-page redirects and payload formats.
  • Accept sp.live.nicovideo.jp watch URLs and fall back from embedded-data to initial-state.
  • Read program ID, vpos base time, and WebSocket URL from the mobile pageContents structure.
  • Normalize millisecond timestamps and decode broader numeric HTML entities.
src/plugins/nicojk/niconico-watch-page.ts
tests/nicojk-watch-page.test.ts
Update repository build and package-authentication guidance and generated plugin metadata.
  • Document direnv-based local builds and keep GitHub Packages credentials in the user npm configuration.
  • Update plugin manifest metadata.
.npmrc
AGENTS.md
scripts/plugins-manifest.json
src/plugins/nicojk/agents.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ci7lus
ci7lus force-pushed the fix/ios-redirect branch 2 times, most recently from 9b13c22 to ad3f3b4 Compare August 26, 2026 13:53
@ci7lus
ci7lus merged commit 6eb7f65 into main Aug 26, 2026
3 checks passed
@ci7lus
ci7lus deleted the fix/ios-redirect branch August 26, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant