[artstation] simplify '_no_cache()'
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
from .common import Extractor, Message
|
||||
from .. import text, util, exception
|
||||
import itertools
|
||||
import random
|
||||
import string
|
||||
|
||||
|
||||
class ArtstationExtractor(Extractor):
|
||||
@@ -173,7 +171,7 @@ class ArtstationExtractor(Extractor):
|
||||
).json()["public_csrf_token"]
|
||||
|
||||
@staticmethod
|
||||
def _no_cache(url, alphabet=(string.digits + string.ascii_letters)):
|
||||
def _no_cache(url):
|
||||
"""Cause a cache miss to prevent Cloudflare 'optimizations'
|
||||
|
||||
Cloudflare's 'Polish' optimization strips image metadata and may even
|
||||
@@ -185,10 +183,9 @@ class ArtstationExtractor(Extractor):
|
||||
https://github.com/r888888888/danbooru/issues/3528
|
||||
https://danbooru.donmai.us/forum_topics/14952
|
||||
"""
|
||||
param = "gallerydl_no_cache=" + util.bencode(
|
||||
random.getrandbits(64), alphabet)
|
||||
sep = "&" if "?" in url else "?"
|
||||
return url + sep + param
|
||||
token = util.generate_token(8)
|
||||
return url + sep + token[:4] + "=" + token[4:]
|
||||
|
||||
|
||||
class ArtstationUserExtractor(ArtstationExtractor):
|
||||
|
||||
Reference in New Issue
Block a user