# nlフィルタ定義(文字コード判定用なのでこの行は削除しないこと)

[RequestHeader]
Name = popThumb_FA：Redirect
URL = www\.dummy\.com
Match<
http://[^/]+/pr_Redirect_([^/]+[.]nicovideo[.]jp/.+)
>
Replace<
http://$1
>

[Replace]
Name = popThumb_FA：JS SET
URL = [^/]*?\.nicovideo.jp/(?!local/popThumb_FA_iframe\.html|.*?\.js)
MatchLocal = TRUE
ContentType = text/html
Match<
</body>
>
Replace<
<div id="nico_popThumb_container"></div>
<script type="text/javascript" src="http://www.nicovideo.jp/$TS(local/popThumb_FA.js)"></script>
<link rel="stylesheet" type="text/css" href="http://www.nicovideo.jp/$TS(local/popThumb_FA.css)">
$0
>

[Replace]
Name = popThumb_FA：キャッシュ情報を付加(getthumbinfo)
URL = ext\.nicovideo\.jp/api/getthumbinfo(?:\?v=|/)\w{2}\d+
idGroup = 1
Match<
<video_id>([a-z]{2}\d+)</video_id>(?!\s*<cache>)(\s*)
>
Replace<
$0<cache><icon$economy></cache>$2
>

[Replace]
Name = popThumb_FA：キャッシュ情報を付加(video.array)
URL = i\.nicovideo\.jp/v3/video\.array
Multi = TRUE
idGroup = 1
Match<
<video_info><video><id>([a-z]{2}\d+)</id>(?!\s*<cache>)
>
Replace<
$0<cache><icon$economy></cache>
>

#((?:sm|nm|so|ca|ax|yo|nl|ig|na|cw|z[a-e]|om|sk|yk)\d+)
[Replace]
Name = popThumb_FA：キャッシュ済み動画のリストをXMLに埋め込み：収集
URL = (ext\.nicovideo\.jp/api/getthumbinfo(?:\?v=|/)\w{2}\d+|i\.nicovideo\.jp/v3/video\.array)
Multi = TRUE
AddVariable = popThumb_FA_cached_smid_list
idGroup = 1
Require = !<popThumb_FA_cached_smid_list>
Match<
((?:sm|nm|so|ca|ax|yo|nl|ig|na|cw|z[a-e]|om|sk|yk|(?<=watch/))\d+)(?!\d*</watch_url>)
>
Replace<
$1<$low>,
>

[Replace]
Name = popThumb_FA：キャッシュ済み動画のリストをXMLに埋め込み：書き出し
URL = (ext\.nicovideo\.jp/api/getthumbinfo(?:\?v=|/)\w{2}\d+|i\.nicovideo\.jp/v3/video\.array)
Require = !<popThumb_FA_cached_smid_list>
Match<
(\s*)</nicovideo_(?:thumb|video)_response>
>
Replace<
$1<popThumb_FA_cached_smid_list><nlVar:popThumb_FA_cached_smid_list></popThumb_FA_cached_smid_list>$0
>

[Replace]
Name = popThumb_FA：IFRAME内のjs/cssを最新のものに
URL = www\.nicovideo\.jp/local/popThumb_FA_iframe\.html
EachLine = TRUE
Match<
(?<= src="http://www.nicovideo.jp/)local/popThumb_FA\.js[^"]*
(?<= href="http://www.nicovideo.jp/)local/popThumb_FA.css[^"]*
>
Replace<
$TS(local/popThumb_FA.js)
$TS(local/popThumb_FA.css)
>


# nl本体の対応で不要に?
#[Replace]
Name = popThumb_FA：キャッシュ済動画の判定2
URL = ext.nicovideo.jp/api/getthumbinfo/\w{2}\d+\?nlFilter
Require = !</cache>
idGroup = 1
Match<
[?]i=(\d+)</thumbnail_url>
>
Replace<
$0
<cache><icon$economy></cache>
>

[Replace]
Name = popThumb_FA：削除済み動画のキャッシュタイトル変更用
URL = ext.nicovideo.jp/thumb/[a-z]{2}\d+.*?\?pop_FA
idGroup = 1
Match<
<p class="TXT12"><a href="http://www.nicovideo.jp/watch/([a-z]{2}[0-9]+)"[\s\S]*?</p>
>
Replace<
$0
<p class="font12" id="pop_cache_title_$1">キャッシュタイトル受信中...</p>
>
