This repository has been archived by the owner on Aug 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add initial unit tests and code cleanup (#129)
- Loading branch information
1 parent
0558bf9
commit 7c06806
Showing
22 changed files
with
388 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,3 +168,6 @@ plexhints-temp | |
|
||
# Remove python modules | ||
Contents/Libraries/Shared/ | ||
|
||
# Remove plex service file cache | ||
*.pys[cod] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
codecov: | ||
branch: master | ||
|
||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: auto | ||
threshold: 10% | ||
|
||
comment: | ||
layout: "diff, flags, files" | ||
behavior: default | ||
require_changes: false # if true: only post the comment if coverage changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py | ||
index 3c526a78d..6e2a92d92 100644 | ||
--- a/youtube_dl/compat.py | ||
+++ b/youtube_dl/compat.py | ||
@@ -58,18 +58,22 @@ except ImportError: # Python 2 | ||
|
||
# Also fix up lack of method arg in old Pythons | ||
try: | ||
- _req = compat_urllib_request.Request | ||
- _req('http://127.0.0.1', method='GET') | ||
+ type(compat_urllib_request.Request('http://127.0.0.1', method='GET')) | ||
except TypeError: | ||
- class _request(object): | ||
- def __new__(cls, url, *args, **kwargs): | ||
- method = kwargs.pop('method', None) | ||
- r = _req(url, *args, **kwargs) | ||
- if method: | ||
- r.get_method = types.MethodType(lambda _: method, r) | ||
- return r | ||
- | ||
- compat_urllib_request.Request = _request | ||
+ def _add_init_method_arg(cls): | ||
+ init = cls.__init__ | ||
+ | ||
+ def wrapped_init(self, *args, **kwargs): | ||
+ method = kwargs.pop('method', 'GET') | ||
+ init(self, *args, **kwargs) | ||
+ if self.has_data() and method == 'GET': | ||
+ method = 'POST' | ||
+ self.get_method = types.MethodType(lambda _: method, self) | ||
+ | ||
+ cls.__init__ = wrapped_init | ||
+ | ||
+ _add_init_method_arg(compat_urllib_request.Request) | ||
+ del _add_init_method_arg | ||
|
||
|
||
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py | ||
index 9c419c002..3bf483c1c 100644 | ||
--- a/youtube_dl/extractor/youtube.py | ||
+++ b/youtube_dl/extractor/youtube.py | ||
@@ -260,16 +260,10 @@ class YoutubeBaseInfoExtractor(InfoExtractor): | ||
cookies = self._get_cookies('https://www.youtube.com/') | ||
if cookies.get('__Secure-3PSID'): | ||
return | ||
- consent_id = None | ||
- consent = cookies.get('CONSENT') | ||
- if consent: | ||
- if 'YES' in consent.value: | ||
- return | ||
- consent_id = self._search_regex( | ||
- r'PENDING\+(\d+)', consent.value, 'consent', default=None) | ||
- if not consent_id: | ||
- consent_id = random.randint(100, 999) | ||
- self._set_cookie('.youtube.com', 'CONSENT', 'YES+cb.20210328-17-p0.en+FX+%s' % consent_id) | ||
+ socs = cookies.get('SOCS') | ||
+ if socs and not socs.value.startswith('CAA'): # not consented | ||
+ return | ||
+ self._set_cookie('.youtube.com', 'SOCS', 'CAI', secure=True) # accept all (required for mixes) | ||
|
||
def _real_initialize(self): | ||
self._initialize_consent() |
Oops, something went wrong.