1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-18 15:35:14 +00:00

[compat] Add functools.cached_property

This commit is contained in:
pukkandan
2022-05-20 20:55:21 +05:30
parent 666c36d58d
commit 2762dbb17e
5 changed files with 21 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ import sys
import time
import xml.etree.ElementTree
from ..compat import functools, re
from ..compat import (
compat_cookiejar_Cookie,
compat_cookies_SimpleCookie,
@@ -25,7 +26,6 @@ from ..compat import (
compat_urllib_parse_urlencode,
compat_urllib_request,
compat_urlparse,
re,
)
from ..downloader import FileDownloader
from ..downloader.f4m import get_base_url, remove_encrypted_media
@@ -3748,7 +3748,7 @@ class InfoExtractor:
def _get_automatic_captions(self, *args, **kwargs):
raise NotImplementedError('This method must be implemented by subclasses')
@property
@functools.cached_property
def _cookies_passed(self):
"""Whether cookies have been passed to YoutubeDL"""
return self.get_param('cookiefile') is not None or self.get_param('cookiesfrombrowser') is not None

View File

@@ -2,7 +2,6 @@ import base64
import calendar
import copy
import datetime
import functools
import hashlib
import itertools
import json
@@ -16,6 +15,7 @@ import time
import traceback
from .common import InfoExtractor, SearchInfoExtractor
from ..compat import functools
from ..compat import (
compat_chr,
compat_HTTPError,
@@ -534,7 +534,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
args, [('VISITOR_DATA', ('INNERTUBE_CONTEXT', 'client', 'visitorData'), ('responseContext', 'visitorData'))],
expected_type=str)
@property
@functools.cached_property
def is_authenticated(self):
return bool(self._generate_sapisidhash_header())
@@ -4402,7 +4402,7 @@ class YoutubeTabBaseInfoExtractor(YoutubeBaseInfoExtractor):
check_get_keys='contents', fatal=False, ytcfg=ytcfg,
note='Downloading API JSON with unavailable videos')
@property
@functools.cached_property
def skip_webpage(self):
return 'webpage' in self._configuration_arg('skip', ie_key=YoutubeTabIE.ie_key())