nijie: fetch artist commentary.
This commit is contained in:
@@ -39,10 +39,18 @@ module Sources
|
|||||||
@artist_name, @profile_url = get_profile_from_page(page)
|
@artist_name, @profile_url = get_profile_from_page(page)
|
||||||
@image_url = get_image_url_from_page(page)
|
@image_url = get_image_url_from_page(page)
|
||||||
@tags = get_tags_from_page(page)
|
@tags = get_tags_from_page(page)
|
||||||
|
@artist_commentary_title, @artist_commentary_desc = get_commentary_from_page(page)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def get_commentary_from_page(page)
|
||||||
|
title = page.search("h2.illust_title").text
|
||||||
|
desc = page.search('meta[property="og:description"]').attr("content").value
|
||||||
|
|
||||||
|
[title, desc]
|
||||||
|
end
|
||||||
|
|
||||||
def get_profile_from_page(page)
|
def get_profile_from_page(page)
|
||||||
links = page.search("a.name")
|
links = page.search("a.name")
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,14 @@ module Sources
|
|||||||
should "get the tags" do
|
should "get the tags" do
|
||||||
assert_equal([["眼鏡", "http://nijie.info/search.php?word=%E7%9C%BC%E9%8F%A1"], ["リトルウィッチアカデミア", "http://nijie.info/search.php?word=%E3%83%AA%E3%83%88%E3%83%AB%E3%82%A6%E3%82%A3%E3%83%83%E3%83%81%E3%82%A2%E3%82%AB%E3%83%87%E3%83%9F%E3%82%A2"], ["アーシュラ先生", "http://nijie.info/search.php?word=%E3%82%A2%E3%83%BC%E3%82%B7%E3%83%A5%E3%83%A9%E5%85%88%E7%94%9F"]], @site.tags)
|
assert_equal([["眼鏡", "http://nijie.info/search.php?word=%E7%9C%BC%E9%8F%A1"], ["リトルウィッチアカデミア", "http://nijie.info/search.php?word=%E3%83%AA%E3%83%88%E3%83%AB%E3%82%A6%E3%82%A3%E3%83%83%E3%83%81%E3%82%A2%E3%82%AB%E3%83%87%E3%83%9F%E3%82%A2"], ["アーシュラ先生", "http://nijie.info/search.php?word=%E3%82%A2%E3%83%BC%E3%82%B7%E3%83%A5%E3%83%A9%E5%85%88%E7%94%9F"]], @site.tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "get the commentary" do
|
||||||
|
title = "ジャージの下は"
|
||||||
|
desc = "「リトルウィッチアカデミア」から無自覚サキュバスぶりを発揮するアーシュラ先生です"
|
||||||
|
|
||||||
|
assert_equal(title, @site.artist_commentary_title)
|
||||||
|
assert_equal(desc, @site.artist_commentary_desc)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "The source site for a nijie referer url" do
|
context "The source site for a nijie referer url" do
|
||||||
|
|||||||
Reference in New Issue
Block a user