tumblr: don't fail when api data is unavailable (#3948).

The api data is unavailable when the work is deleted (bad_tumblr_id), or
when the source is a direct image url with no page referer.
This commit is contained in:
evazion
2018-10-09 11:57:23 -05:00
parent 4c55c809b0
commit 0c31a5d6a9
3 changed files with 23 additions and 27 deletions

View File

@@ -155,7 +155,7 @@ module Sources
should "get the image urls" do
urls = %w[
https://vtt.tumblr.com/tumblr_os31dkexhK1wsfqep.mp4
https://ve.media.tumblr.com/tumblr_os31dkexhK1wsfqep.mp4
https://media.tumblr.com/afed9f5b3c33c39dc8c967e262955de2/tumblr_inline_os31dclyCR1v11u29_1280.png
]
@@ -178,5 +178,13 @@ module Sources
assert_match("test answer", @site.artist_commentary_desc)
end
end
context "A deleted tumblr post" do
should "work" do
site = Sources::Strategies.find("http://shimetsukage.tumblr.com/post/176805588268/20180809-ssb-coolboy")
assert_nothing_raised { site.to_h }
end
end
end
end