1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 11:12:40 +01:00

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

This commit is contained in:
Mike Fährmann 2021-01-25 14:52:22 +01:00
parent cdb0b02e30
commit 24e8e398e0
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -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):