[twitter] skip login if 'auth_token' cookie is present

pull/1294/head
Mike Fährmann 4 years ago
parent cdb0b02e30
commit 24e8e398e0
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -26,6 +26,7 @@ class TwitterExtractor(Extractor):
filename_fmt = "{tweet_id}_{num}.{extension}"
archive_fmt = "{tweet_id}_{retweet_id}_{num}"
cookiedomain = ".twitter.com"
cookienames = ("auth_token",)
root = "https://twitter.com"
def __init__(self, match):
@ -231,9 +232,10 @@ class TwitterExtractor(Extractor):
"""Yield all relevant tweet objects"""
def login(self):
username, password = self._get_auth_info()
if username:
self._update_cookies(self._login_impl(username, password))
if not self._check_cookies(self.cookienames):
username, password = self._get_auth_info()
if username:
self._update_cookies(self._login_impl(username, password))
@cache(maxage=360*24*3600, keyarg=1)
def _login_impl(self, username, password):

Loading…
Cancel
Save