[weibo] detect redirects to login page (#4773)
This commit is contained in:
@@ -41,9 +41,14 @@ class WeiboExtractor(Extractor):
|
|||||||
def request(self, url, **kwargs):
|
def request(self, url, **kwargs):
|
||||||
response = Extractor.request(self, url, **kwargs)
|
response = Extractor.request(self, url, **kwargs)
|
||||||
|
|
||||||
if response.history and "passport.weibo.com" in response.url:
|
if response.history:
|
||||||
self._sina_visitor_system(response)
|
if "login.sina.com" in response.url:
|
||||||
response = Extractor.request(self, url, **kwargs)
|
raise exception.StopExtraction(
|
||||||
|
"HTTP redirect to login page (%s)",
|
||||||
|
response.url.partition("?")[0])
|
||||||
|
if "passport.weibo.com" in response.url:
|
||||||
|
self._sina_visitor_system(response)
|
||||||
|
response = Extractor.request(self, url, **kwargs)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user