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).
This commit is contained in:
evazion
2022-02-25 01:54:19 -06:00
parent 26f4cf1ebd
commit e6ded89f85
5 changed files with 170 additions and 41 deletions

View File

@@ -342,6 +342,9 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
should_upload_successfully("https://skeb.jp/@kokuzou593/works/45")
should_upload_successfully("https://skeb.jp/@LambOic029/works/146")
should_upload_successfully("https://skeb.imgix.net/uploads/origins/307941e9-dbe0-4e4b-93d4-94accdaff9a0?bg=%23fff&auto=format&w=800&s=e0ddfb1fa0d9f23797b338598aae78fa")
should_upload_successfully("https://www.plurk.com/p/omc64y")
should_upload_successfully("https://www.plurk.com/p/om6zv4")
end
end
end

View File

@@ -37,16 +37,56 @@ module Sources
end
should "get the image urls for an adult post" do
images = ["https://images.plurk.com/yfnumBJqqoQt50Em6xKwf.png",
"https://images.plurk.com/5NaqqO3Yi6bQW1wKXq1Dc2.png",
"https://images.plurk.com/3HzNcbMhCozHPk5YY8j9fI.png",
"https://images.plurk.com/2e0duwn8BpSW9MGuUvbrim.png",
"https://images.plurk.com/1OuiMDp82hYPEUn64CWFFB.png",
"https://images.plurk.com/3F3KzZOabeMYkgTeseEZ0r.png",
"https://images.plurk.com/7onKKTAIXkY4pASszrBys8.png",
"https://images.plurk.com/6aotmjLGbtMLiI3slN7ODv.png",
"https://images.plurk.com/6pzn7jE2nkj9EV7H25L0x1.png",
"https://images.plurk.com/yA8egjDuhy0eNG9yxRj1d.png",]
images = %w[
https://images.plurk.com/yfnumBJqqoQt50Em6xKwf.png
https://images.plurk.com/5NaqqO3Yi6bQW1wKXq1Dc2.png
https://images.plurk.com/3HzNcbMhCozHPk5YY8j9fI.png
https://images.plurk.com/2e0duwn8BpSW9MGuUvbrim.png
https://images.plurk.com/1OuiMDp82hYPEUn64CWFFB.png
https://images.plurk.com/3F3KzZOabeMYkgTeseEZ0r.png
https://images.plurk.com/7onKKTAIXkY4pASszrBys8.png
https://images.plurk.com/6aotmjLGbtMLiI3slN7ODv.png
https://images.plurk.com/6pzn7jE2nkj9EV7H25L0x1.png
https://images.plurk.com/yA8egjDuhy0eNG9yxRj1d.png
https://images.plurk.com/55tbTkH3cKTTYkZe9fu1Pv.png
https://images.plurk.com/5z64F9uUipJ0fMJWXNGHTw.png
https://images.plurk.com/6cwurMe6jymEu6INzmyg74.png
https://images.plurk.com/7zyTReS8UVyCFYtU1DJRYt.png
https://images.plurk.com/1PiRWGzaXozU15Scx1ZC4T.png
https://images.plurk.com/2xzB5qacdLVV75GhaFifaY.png
https://images.plurk.com/7uQENFmFNtWSKF0AAQKffr.png
https://images.plurk.com/7ChGLokdAezvbEjPCLUr8f.png
https://images.plurk.com/3AzjLxynamDGxNDTq4wt5x.png
https://images.plurk.com/3SYjvKc3IBbz6ZXWeG1pY8.png
https://images.plurk.com/7bk2kYN2fEVV0kiT5qoiuO.png
https://images.plurk.com/6mgCwWjSqOfi0BtSg6THcZ.png
https://images.plurk.com/3BwtMvr6S13gr96r5TLIFd.png
https://images.plurk.com/22CPzkRM71frDR5eRMPthC.png
https://images.plurk.com/1IFScoxA7m0FXNu6XirBwa.jpg
https://images.plurk.com/5v1ZXQxbS7ocV4BybwbCSs.jpg
https://images.plurk.com/4n1og7pg4KP3wRYSKpFzF7.png
https://images.plurk.com/5gK1PyPTrVYoeZBr10lEYu.png
https://images.plurk.com/3m8YZS3D9vaAH8Lw1LDTix.png
https://images.plurk.com/3oy7joPrEFm0Wlo7NplXOl.png
https://images.plurk.com/2IBA93ghmCJCJT72mQyLUK.png
https://images.plurk.com/16jqEhVqtuLJwnRjpIDRCr.png
https://images.plurk.com/7cKzaSigAvKc6DKNxeGmnH.png
https://images.plurk.com/ypfkOMsC24hIPGSEWjJ8A.png
https://images.plurk.com/5qW11yr06e9u3t5Zt9Jxmm.png
https://images.plurk.com/4H5st1xsFDSFgLd7gNXgD8.png
https://images.plurk.com/4nf49mWygwQyrYriZ453Qx.png
https://images.plurk.com/2Y0TXcYZkni94j7yxxosV9.png
https://images.plurk.com/5ih71C9XNJDq88wzKbBdNp.png
https://images.plurk.com/UmoZjSHx0Y4NYa3mgKffU.png
https://images.plurk.com/4IHGG5mQNw95vqClFEBoOM.png
https://images.plurk.com/5J3bRPjGBZV8fDxo7cTwGs.png
https://images.plurk.com/3uAjR5oBfe4d6MFThFQ0Gt.png
https://images.plurk.com/3fFJ8RN3HkmfcuUdn7OpnQ.png
https://images.plurk.com/sxkaWnhmDrCSsUEg6Kn9Y.png
https://images.plurk.com/1f3W8JnHlwpt3OlT4ZJhiu.gif
https://images.plurk.com/5lNGKqPCf6opXu21f5DdbU.gif
]
assert_equal(images, @post4.image_urls)
end