fixes #2746: Uploading from touch.pixiv.net broken
This commit is contained in:
@@ -11,12 +11,13 @@ module Sources
|
||||
TIMESTAMP = '(?:[0-9]{4}/[0-9]{2}/[0-9]{2}/[0-9]{2}/[0-9]{2}/[0-9]{2})'
|
||||
EXT = "(?:jpg|jpeg|png|gif)"
|
||||
|
||||
WEB = "^(?:https?://)?www\\.pixiv\\.net"
|
||||
I12 = "^(?:https?://)?i[0-9]+\\.pixiv\\.net"
|
||||
IMG = "^(?:https?://)?img[0-9]*\\.pixiv\\.net"
|
||||
WEB = "^(?:https?://)?www\\.pixiv\\.net"
|
||||
I12 = "^(?:https?://)?i[0-9]+\\.pixiv\\.net"
|
||||
IMG = "^(?:https?://)?img[0-9]*\\.pixiv\\.net"
|
||||
TOUCH = "^(?:https?://)?touch\\.pixiv\\.net"
|
||||
|
||||
def self.url_match?(url)
|
||||
url =~ /#{WEB}|#{IMG}|#{I12}/i
|
||||
url =~ /#{WEB}|#{IMG}|#{I12}|#{TOUCH}/i
|
||||
end
|
||||
|
||||
def referer_url
|
||||
@@ -343,8 +344,8 @@ module Sources
|
||||
end
|
||||
|
||||
def work_page?
|
||||
return true if url =~ %r!#{WEB}/member_illust\.php\?mode=(?:medium|big|manga|manga_big)&illust_id=\d+!i
|
||||
return true if url =~ %r!#{WEB}/i/\d+$!i
|
||||
return true if url =~ %r!(?:#{WEB}|#{TOUCH})/member_illust\.php\?mode=(?:medium|big|manga|manga_big)&illust_id=\d+!i
|
||||
return true if url =~ %r!(?:#{WEB}|#{TOUCH})/i/\d+$!i
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
2615
test/fixtures/vcr_cassettes/sources-pixiv-test/touch.yml
vendored
Normal file
2615
test/fixtures/vcr_cassettes/sources-pixiv-test/touch.yml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,19 @@ module Sources
|
||||
end
|
||||
end
|
||||
|
||||
context "A touch page" do
|
||||
setup do
|
||||
VCR.use_cassette("sources-pixiv-test/touch", :record => @vcr_record_option) do
|
||||
@site = Sources::Site.new("http://touch.pixiv.net/member_illust.php?mode=medium&illust_id=59687915")
|
||||
@image_urls = @site.get
|
||||
end
|
||||
end
|
||||
|
||||
should "get all the image urls" do
|
||||
assert_equal("http://i4.pixiv.net/img-original/img/2016/10/29/17/13/23/59687915_p0.png", @image_urls)
|
||||
end
|
||||
end
|
||||
|
||||
context "A gallery page" do
|
||||
setup do
|
||||
VCR.use_cassette("sources-pixiv-test/gallery", :record => @vcr_record_option) do
|
||||
|
||||
Reference in New Issue
Block a user