Newgrounds: fix support for some old videos
This commit is contained in:
@@ -14,7 +14,9 @@ module Source
|
||||
elsif parsed_url.image_url?
|
||||
[url]
|
||||
elsif video_data.present?
|
||||
[video_data.dig("sources", "1080p", 0, "src")&.sub(".1080p.", ".")].compact
|
||||
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].compact
|
||||
else
|
||||
urls = []
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ module Sources
|
||||
context "A newgrounds video post" do
|
||||
strategy_should_work(
|
||||
"https://www.newgrounds.com/portal/view/536659",
|
||||
image_urls: [%r{https://uploads\.ungrounded\.net/alternate/167000/167280_alternate_602\.mp4}],
|
||||
image_urls: ["https://uploads.ungrounded.net/alternate/167000/167280_alternate_602.mp4"],
|
||||
profile_url: "https://jenjamik.newgrounds.com",
|
||||
artist_name: "jenjamik",
|
||||
page_url: "https://www.newgrounds.com/portal/view/536659",
|
||||
@@ -46,6 +46,20 @@ module Sources
|
||||
)
|
||||
end
|
||||
|
||||
context "A newgrounds video post with no 1080p version" do
|
||||
strategy_should_work(
|
||||
"https://www.newgrounds.com/portal/view/758590",
|
||||
image_urls: ["https://uploads.ungrounded.net/alternate/1483000/1483159_alternate_102560.mp4"]
|
||||
)
|
||||
end
|
||||
|
||||
context "A newgrounds video post where all images have the resolution in their url" do
|
||||
strategy_should_work(
|
||||
"https://www.newgrounds.com/portal/view/734778",
|
||||
image_urls: ["https://uploads.ungrounded.net/alternate/1352000/1352451_alternate_80350.1080p.mp4?1563167480"]
|
||||
)
|
||||
end
|
||||
|
||||
context "A newgrounds direct video url" do
|
||||
strategy_should_work(
|
||||
"https://uploads.ungrounded.net/alternate/1801000/1801343_alternate_165104.360p.mp4?1639666238",
|
||||
|
||||
Reference in New Issue
Block a user