@@ -15,7 +15,7 @@ module Source
|
|||||||
[url]
|
[url]
|
||||||
elsif video_data.present?
|
elsif video_data.present?
|
||||||
sample = video_data&.[]("sources")&.max_by { |k, _v| k.gsub(/p$/, "").to_i }&.dig(1, 0, "src")
|
sample = video_data&.[]("sources")&.max_by { |k, _v| k.gsub(/p$/, "").to_i }&.dig(1, 0, "src")
|
||||||
final = [Source::URL.parse(sample).full_image_url, sample].find { |u| http_exists?(u) }
|
final = [Source::URL.parse(sample)&.full_image_url, sample].compact.find { |u| http_exists?(u) }
|
||||||
[final].compact
|
[final].compact
|
||||||
else
|
else
|
||||||
urls = []
|
urls = []
|
||||||
|
|||||||
@@ -82,11 +82,21 @@ module Sources
|
|||||||
strategy_should_work(
|
strategy_should_work(
|
||||||
"https://www.newgrounds.com/art/view/natthelich/nopicture",
|
"https://www.newgrounds.com/art/view/natthelich/nopicture",
|
||||||
deleted: true,
|
deleted: true,
|
||||||
|
image_urls: [],
|
||||||
profile_url: "https://natthelich.newgrounds.com",
|
profile_url: "https://natthelich.newgrounds.com",
|
||||||
artist_name: "natthelich"
|
artist_name: "natthelich"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "A deleted or non-existing video" do
|
||||||
|
strategy_should_work(
|
||||||
|
"https://www.newgrounds.com/portal/view/802594",
|
||||||
|
deleted: true,
|
||||||
|
image_urls: [],
|
||||||
|
profile_url: nil
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
context "A www.newgrounds.com/dump/item URL" do
|
context "A www.newgrounds.com/dump/item URL" do
|
||||||
strategy_should_work(
|
strategy_should_work(
|
||||||
"https://www.newgrounds.com/dump/item/a1f417d20f5eaef31e26ac3c4956b3d4",
|
"https://www.newgrounds.com/dump/item/a1f417d20f5eaef31e26ac3c4956b3d4",
|
||||||
|
|||||||
Reference in New Issue
Block a user