From e6ded89f8522404dc75882893a9292417bf9ccf4 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 25 Feb 2022 01:54:19 -0600 Subject: [PATCH] sources: factor out Source::URL::Plurk. Also fix it so that for adult works, we get the images posted by the artist in the replies. Example: https://www.plurk.com/p/omc64y (nsfw). --- app/logical/source/url.rb | 1 + app/logical/source/url/plurk.rb | 68 +++++++++++++++++++ app/logical/sources/strategies/plurk.rb | 79 +++++++++++++--------- test/functional/uploads_controller_test.rb | 3 + test/unit/sources/plurk_test.rb | 60 +++++++++++++--- 5 files changed, 170 insertions(+), 41 deletions(-) create mode 100644 app/logical/source/url/plurk.rb diff --git a/app/logical/source/url.rb b/app/logical/source/url.rb index d2dc04edc..783761863 100644 --- a/app/logical/source/url.rb +++ b/app/logical/source/url.rb @@ -19,6 +19,7 @@ module Source class URL < Danbooru::URL SUBCLASSES = [ Source::URL::Twitter, + Source::URL::Plurk, Source::URL::Skeb, Source::URL::TwitPic, Source::URL::Foundation, diff --git a/app/logical/source/url/plurk.rb b/app/logical/source/url/plurk.rb new file mode 100644 index 000000000..d32a14552 --- /dev/null +++ b/app/logical/source/url/plurk.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +# Notes +# +# * Posts can have up to 10 images. +# * Artists commonly post extra images by replying to their own post. +# * Adult posts are hidden for logged out users. The main images can be found by +# scraping a