[keenspot] improve redirect handling
Before it would use http:// for all requests and get a redirect to a https:// version if those are supported. Now the redirect only happens once during the first request.
This commit is contained in:
@@ -39,7 +39,7 @@ class KeenspotComicExtractor(Extractor):
|
|||||||
}),
|
}),
|
||||||
("http://twokinds.keenspot.com/comic/1066/", { # "random" access
|
("http://twokinds.keenspot.com/comic/1066/", { # "random" access
|
||||||
"range": "1-3",
|
"range": "1-3",
|
||||||
"url": "97e2a6ed8ba1709314f2449f84b6b1ce5db21c04",
|
"url": "6a784e11370abfb343dcad9adbb7718f9b7be350",
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -58,7 +58,14 @@ class KeenspotComicExtractor(Extractor):
|
|||||||
yield Message.Version, 1
|
yield Message.Version, 1
|
||||||
yield Message.Directory, data
|
yield Message.Directory, data
|
||||||
|
|
||||||
url = self._first(self.request(self.root + "/").text)
|
with self.request(self.root + "/") as response:
|
||||||
|
if response.history:
|
||||||
|
url = response.request.url
|
||||||
|
self.root = url[:url.index("/", 8)]
|
||||||
|
page = response.text
|
||||||
|
del response
|
||||||
|
|
||||||
|
url = self._first(page)
|
||||||
if self.path:
|
if self.path:
|
||||||
url = self.root + self.path
|
url = self.root + self.path
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user