mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2024-11-10 17:25:59 +08:00
parent
f2b47fb392
commit
3e759615a4
2 changed files with 4 additions and 3 deletions
|
@ -59,7 +59,7 @@ class Channel(Payment):
|
|||
cookie = {"CONSENT": "YES+cb.20210328-17-p0.en+FX+999"}
|
||||
# send head request first
|
||||
r = requests.head(url, headers=headers, allow_redirects=True, cookies=cookie)
|
||||
if r.status_code != http.HTTPStatus.METHOD_NOT_ALLOWED and "text/html" not in r.headers.get("content-type"):
|
||||
if r.status_code != http.HTTPStatus.METHOD_NOT_ALLOWED and "text/html" not in r.headers.get("content-type", ""):
|
||||
# get content-type, if it's not text/html, there's no need to issue a GET request
|
||||
logging.warning("%s Content-type is not text/html, no need to GET for extract_canonical_link", url)
|
||||
return url
|
||||
|
|
|
@ -71,9 +71,10 @@ class Cursor:
|
|||
|
||||
class Redis:
|
||||
def __init__(self):
|
||||
if REDIS:
|
||||
try:
|
||||
self.r = redis.StrictRedis(host=REDIS, db=0, decode_responses=True)
|
||||
else:
|
||||
self.r.ping()
|
||||
except redis.RedisError:
|
||||
self.r = fakeredis.FakeStrictRedis(host=REDIS, db=0, decode_responses=True)
|
||||
|
||||
db_banner = "=" * 20 + "DB data" + "=" * 20
|
||||
|
|
Loading…
Reference in a new issue