GetTimetagLyrics/LUA/www31.atwiki.jp_touhoukashi.lua
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#set_tags(GetTimetagLyricsスクリプト)
#pre{{
function LyricsInfoGet(html)
--記事部分を取り出す
is1, ie1 = html:find("<div class=\"contents\" id=\"co...
--無いときは抜ける
if is1 == nil then
return
end
is2, ie2 = html:find("<div class=\"ads\">", ie1+1)
body = html:sub(ie1+1, is2-1)
--記事から歌詞を取り出す
--歌詞の頭を探す
is2 = 1
is1,ie1 = body:find("\nアルバム")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
--is1,ie1 = body:find("\n.ークル")
--if (is1 == nil) then elseif (is2<ie1) then is2=ie1 ...
is1,ie1 = body:find("\nVocal")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
is1,ie1 = body:find("\nvocal")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
is1,ie1 = body:find("\nVOCAL")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
is1,ie1 = body:find("\n原曲")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
is1,ie1 = body:find("\n",is2)
lyrics = body:sub(ie1+1)
--HTMLテキストのdiv,改行,ルビを消す
--\n\n</div>は改行とする
lyrics = lyrics:gsub("\n\n</div>", "<br />")
lyrics = lyrics:gsub("<div>", "")
lyrics = lyrics:gsub("</div>", "")
lyrics = lyrics:gsub("\n", "")
lyrics = lyrics:gsub("<rt>.-</rt>", "")
lyrics = lyrics:gsub("<rp>.-</rp>", "")
lyrics = lyrics:gsub("<rb>", "")
lyrics = lyrics:gsub("</rb>", "")
lyrics = lyrics:gsub("<ruby>", "")
lyrics = lyrics:gsub("</ruby>", "")
lyrics = lyrics:gsub("<span.->", "")
lyrics = lyrics:gsub("</span>", "")
lyrics = lyrics:gsub("<!\-\-.-\-\->", "")
lyrics = lyrics:gsub("<a .->", "")
lyrics = lyrics:gsub("</a>", "")
--<br />を改行にする
lyrics = lyrics:gsub("<br />", "\r\n")
--行頭と行末の改行を削除
while lyrics:sub(1,2) == "\r\n" do lyrics = lyrics:su...
while lyrics:sub(-2) == "\r\n" do lyrics = lyrics:sub...
--行頭と行末の空白を削除
while lyrics:sub(1,1) == " " do lyrics = lyrics:sub(2...
while lyrics:sub(-1) == " " do lyrics = lyrics:sub(1,...
--特殊文字
lyrics = lyrics:gsub("<", "<")
lyrics = lyrics:gsub(">", ">")
lyrics = lyrics:gsub(" ", " ")
lyrics = lyrics:gsub(""", "\"")
lyrics = lyrics:gsub("&", "&")
--タイトルを取り出す
title = body:match("<h1 class=\"item\">(.-)</h1>")
title = title:gsub("<a .->","")
title = title:gsub("</a>","")
title = title:gsub("^%d%d ", "")
--特殊文字
title = title:gsub("<", "<")
title = title:gsub(">", ">")
title = title:gsub(" ", " ")
title = title:gsub(""", "\"")
title = title:gsub("&", "&")
--アーティスト名を取り出す
artist = body:match("\nサ.-クル(.-)\n")
artist = artist:gsub("<a .->","")
artist = artist:gsub("</a>","")
--特殊文字
artist = artist:gsub("<", "<")
artist = artist:gsub(">", ">")
artist = artist:gsub(" ", " ")
artist = artist:gsub(""", "\"")
artist = artist:gsub("&", "&")
repeat
artist_ = artist
artist = artist:gsub("^ ","")
artist = artist:gsub("^ ","")
artist = artist:gsub("^:","")
artist = artist:gsub("^:","")
until artist_ == artist
return "LYRICS="..lyrics, "TITLE="..title , "ARTIST="...
end
}}
#comment
終了行:
#set_tags(GetTimetagLyricsスクリプト)
#pre{{
function LyricsInfoGet(html)
--記事部分を取り出す
is1, ie1 = html:find("<div class=\"contents\" id=\"co...
--無いときは抜ける
if is1 == nil then
return
end
is2, ie2 = html:find("<div class=\"ads\">", ie1+1)
body = html:sub(ie1+1, is2-1)
--記事から歌詞を取り出す
--歌詞の頭を探す
is2 = 1
is1,ie1 = body:find("\nアルバム")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
--is1,ie1 = body:find("\n.ークル")
--if (is1 == nil) then elseif (is2<ie1) then is2=ie1 ...
is1,ie1 = body:find("\nVocal")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
is1,ie1 = body:find("\nvocal")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
is1,ie1 = body:find("\nVOCAL")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
is1,ie1 = body:find("\n原曲")
if (is1 == nil) then elseif (is2<ie1) then is2=ie1 end
is1,ie1 = body:find("\n",is2)
lyrics = body:sub(ie1+1)
--HTMLテキストのdiv,改行,ルビを消す
--\n\n</div>は改行とする
lyrics = lyrics:gsub("\n\n</div>", "<br />")
lyrics = lyrics:gsub("<div>", "")
lyrics = lyrics:gsub("</div>", "")
lyrics = lyrics:gsub("\n", "")
lyrics = lyrics:gsub("<rt>.-</rt>", "")
lyrics = lyrics:gsub("<rp>.-</rp>", "")
lyrics = lyrics:gsub("<rb>", "")
lyrics = lyrics:gsub("</rb>", "")
lyrics = lyrics:gsub("<ruby>", "")
lyrics = lyrics:gsub("</ruby>", "")
lyrics = lyrics:gsub("<span.->", "")
lyrics = lyrics:gsub("</span>", "")
lyrics = lyrics:gsub("<!\-\-.-\-\->", "")
lyrics = lyrics:gsub("<a .->", "")
lyrics = lyrics:gsub("</a>", "")
--<br />を改行にする
lyrics = lyrics:gsub("<br />", "\r\n")
--行頭と行末の改行を削除
while lyrics:sub(1,2) == "\r\n" do lyrics = lyrics:su...
while lyrics:sub(-2) == "\r\n" do lyrics = lyrics:sub...
--行頭と行末の空白を削除
while lyrics:sub(1,1) == " " do lyrics = lyrics:sub(2...
while lyrics:sub(-1) == " " do lyrics = lyrics:sub(1,...
--特殊文字
lyrics = lyrics:gsub("<", "<")
lyrics = lyrics:gsub(">", ">")
lyrics = lyrics:gsub(" ", " ")
lyrics = lyrics:gsub(""", "\"")
lyrics = lyrics:gsub("&", "&")
--タイトルを取り出す
title = body:match("<h1 class=\"item\">(.-)</h1>")
title = title:gsub("<a .->","")
title = title:gsub("</a>","")
title = title:gsub("^%d%d ", "")
--特殊文字
title = title:gsub("<", "<")
title = title:gsub(">", ">")
title = title:gsub(" ", " ")
title = title:gsub(""", "\"")
title = title:gsub("&", "&")
--アーティスト名を取り出す
artist = body:match("\nサ.-クル(.-)\n")
artist = artist:gsub("<a .->","")
artist = artist:gsub("</a>","")
--特殊文字
artist = artist:gsub("<", "<")
artist = artist:gsub(">", ">")
artist = artist:gsub(" ", " ")
artist = artist:gsub(""", "\"")
artist = artist:gsub("&", "&")
repeat
artist_ = artist
artist = artist:gsub("^ ","")
artist = artist:gsub("^ ","")
artist = artist:gsub("^:","")
artist = artist:gsub("^:","")
until artist_ == artist
return "LYRICS="..lyrics, "TITLE="..title , "ARTIST="...
end
}}
#comment
ページ名: