いけむランド

はてダからやってきました

cclive

いろんな動画サイトから動画を取得できるツールらしい。

cclive is a lightweight command line video extraction tool for Youtube and other similar video websites.


ソースを読んでみたところ、「動画を閲覧する URL」と「動画自体 の URL」のマッピングを内部に保持している (= サービス毎に HostHandler のサブクラスでハードコードされている) 形式らしい。

URL 変換ルールを外部ファイルに書くか、プラグイン作成でユーザが拡張できる方式だったら面白いのになあと思った。

SHP<HostHandler>
HostHandlerFactory::createHandler(const HandlerType& type) {
  switch (type) {
    case Youtube:    return SHP<YoutubeHandler>    (new YoutubeHandler);
    case Google:     return SHP<GoogleHandler>     (new GoogleHandler);
  // skip
    case _last_type: break;
  }
  throw RuntimeException(CCLIVE_INTERNAL);
}

残念ながら(?)、現時点で nicovideo.jp はリストにはないですね。