Newgrounds: support video uploads
This commit is contained in:
@@ -2,21 +2,11 @@
|
||||
|
||||
# Unsupported:
|
||||
#
|
||||
# Video URLs
|
||||
#
|
||||
# * https://www.newgrounds.com/portal/view/825916 (page)
|
||||
# * https://picon.ngfiles.com/825000/flash_825916_card.png?f1639666239 (poster)
|
||||
# * https://uploads.ungrounded.net/alternate/1801000/1801343_alternate_165104.1080p.mp4?1639666238
|
||||
# * https://uploads.ungrounded.net/alternate/1801000/1801343_alternate_165104.720p.mp4?1639666238
|
||||
# * https://uploads.ungrounded.net/alternate/1801000/1801343_alternate_165104.360p.mp4?1639666238
|
||||
#
|
||||
# Flash URLs
|
||||
#
|
||||
# * https://www.newgrounds.com/portal/view/225625 (page)
|
||||
# * https://uploads.ungrounded.net/225000/225625_colormedressup.swf?1111143751 (file)
|
||||
#
|
||||
# * https://www.newgrounds.com/portal/view/225625 (flash page)
|
||||
# * https://uploads.ungrounded.net/225000/225625_colormedressup.swf?1111143751 (flash file)
|
||||
|
||||
class Source::URL::Newgrounds < Source::URL
|
||||
attr_reader :username, :work_id, :work_title, :video_id
|
||||
attr_reader :username, :work_id, :work_title, :video_id, :full_image_url
|
||||
|
||||
def self.match?(url)
|
||||
url.domain.in?(["newgrounds.com", "ngfiles.com", "ungrounded.net"])
|
||||
@@ -36,20 +26,29 @@ class Source::URL::Newgrounds < Source::URL
|
||||
in "www.newgrounds.com", "portal", ("view" | "video"), video_id
|
||||
@video_id = video_id
|
||||
|
||||
# https://uploads.ungrounded.net/alternate/1801000/1801343_alternate_165104.1080p.mp4?1639666238
|
||||
# https://uploads.ungrounded.net/alternate/1801000/1801343_alternate_165104.720p.mp4?1639666238
|
||||
# https://uploads.ungrounded.net/alternate/1801000/1801343_alternate_165104.360p.mp4?1639666238
|
||||
in "uploads.ungrounded.net", "alternate", /^\d+$/ => subdir, /^\d+_alternate_\d+(?:\.\d+p)?\.mp4/ => file
|
||||
max_file = file.sub(/\.\d+p\./, ".")
|
||||
@full_image_url = "https://uploads.ungrounded.net/alternate/#{subdir}/#{max_file}"
|
||||
|
||||
# https://art.ngfiles.com/images/1254000/1254722_natthelich_pandora.jpg
|
||||
# https://art.ngfiles.com/images/1033000/1033622_natthelich_fire-emblem-marth-plus-progress-pic.png?f1569487181
|
||||
in "art.ngfiles.com", "images", _, /^(\d+)_([^_]+)_(.*)\.\w+$/
|
||||
@work_id = $1
|
||||
@username = $2
|
||||
@work_title = $3
|
||||
@full_image_url = original_url
|
||||
|
||||
# https://art.ngfiles.com/thumbnails/1254000/1254985.png?f1588263349
|
||||
in "art.ngfiles.com", "thumbnails", _, /^(\d+)\.\w+$/
|
||||
@work_id = $1
|
||||
@full_image_url = original_url
|
||||
|
||||
# https://art.ngfiles.com/comments/57000/iu_57615_7115981.jpg
|
||||
in "art.ngfiles.com", "comments", _, /^iu/
|
||||
nil
|
||||
@full_image_url = original_url
|
||||
|
||||
# https://natthelich.newgrounds.com
|
||||
# https://natthelich.newgrounds.com/art/
|
||||
@@ -62,7 +61,7 @@ class Source::URL::Newgrounds < Source::URL
|
||||
end
|
||||
|
||||
def image_url?
|
||||
url.host == "art.ngfiles.com"
|
||||
url.host.in? ["art.ngfiles.com", "uploads.ungrounded.net"]
|
||||
end
|
||||
|
||||
def page_url
|
||||
|
||||
Reference in New Issue
Block a user