Skip to content

Commit

Permalink
[CI] auto update youtube_dl to upstream commit 04fd3289d30de3c99c7d2d…
Browse files Browse the repository at this point in the history
…e34d555b050bc96d4d
  • Loading branch information
github-actions[bot] committed May 28, 2022
1 parent d683182 commit 7aa77e9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/youtube_dl/extractor/youporn.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# coding: utf-8
from __future__ import unicode_literals

import re
Expand Down Expand Up @@ -137,9 +138,10 @@ def _real_extract(self, url):
r'(?s)<div[^>]+class=["\']submitByLink["\'][^>]*>(.+?)</div>',
webpage, 'uploader', fatal=False)
upload_date = unified_strdate(self._html_search_regex(
[r'UPLOADED:\s*<span>([^<]+)',
(r'UPLOADED:\s*<span>([^<]+)',
r'Date\s+[Aa]dded:\s*<span>([^<]+)',
r'(?s)<div[^>]+class=["\']videoInfo(?:Date|Time)["\'][^>]*>(.+?)</div>'],
r'''(?s)<div[^>]+class=["']videoInfo(?:Date|Time)\b[^>]*>(.+?)</div>''',
r'(?s)<label\b[^>]*>Uploaded[^<]*</label>\s*<span\b[^>]*>(.+?)</span>'),
webpage, 'upload date', fatal=False))

age_limit = self._rta_search(webpage)
Expand Down
19 changes: 19 additions & 0 deletions lib/youtube_dl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2292,12 +2292,30 @@ def formatSeconds(secs):


def make_HTTPS_handler(params, **kwargs):

# https://www.rfc-editor.org/info/rfc7301
ALPN_PROTOCOLS = ['http/1.1']

def set_alpn_protocols(ctx):
# From https://github.com/yt-dlp/yt-dlp/commit/2c6dcb65fb612fc5bc5c61937bf438d3c473d8d0
# Thanks @coletdjnz
# Some servers may (wrongly) reject requests if ALPN extension is not sent. See:
# https://github.com/python/cpython/issues/85140
# https://github.com/yt-dlp/yt-dlp/issues/3878
try:
ctx.set_alpn_protocols(ALPN_PROTOCOLS)
except (AttributeError, NotImplementedError):
# Python < 2.7.10, not ssl.HAS_ALPN
pass

opts_no_check_certificate = params.get('nocheckcertificate', False)
if hasattr(ssl, 'create_default_context'): # Python >= 3.4 or 2.7.9
context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
set_alpn_protocols(context)
if opts_no_check_certificate:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE

try:
return YoutubeDLHTTPSHandler(params, context=context, **kwargs)
except TypeError:
Expand All @@ -2313,6 +2331,7 @@ def make_HTTPS_handler(params, **kwargs):
if opts_no_check_certificate
else ssl.CERT_REQUIRED)
context.set_default_verify_paths()
set_alpn_protocols(context)
return YoutubeDLHTTPSHandler(params, context=context, **kwargs)


Expand Down
2 changes: 1 addition & 1 deletion lib/youtube_dl_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
187a48aee29847664e0c4cd80fe90c32e1fb334b
04fd3289d30de3c99c7d2de34d555b050bc96d4d

0 comments on commit 7aa77e9

Please sign in to comment.