We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
apt doesn't keep track of latest version
### Checklist

- [X] I'm asking a question and **not** reporting a bug/feature request
- [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar questions including closed ones

### Question

Yesterday I came online and the first thing I did was to run `sudo apt upgrade yt-dlp`. At the time I had a version 2021-12-27 or something similar. Apt then told me I had the latest version and didn't need to upgrade,

I run Linux Mint 20.3 and as it happened the gui Update Manager ran at the same time, and it told me I could upgrade to version 2022.01.21, which I did using the Upgrade Manager.

I have never before experienced the Upgrade Manager telling me about an available upgrade for yt-dlp. Perhaps this is a new interaction. In any case I appreciate it since that's the most dead-sure way of catching new upgrades and being up-to-date.

### Verbose log

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `yt_dlp/extractor/globo.py`
Content:
```
1 # coding: utf-8
2 from __future__ import unicode_literals
3 
4 import base64
5 import hashlib
6 import json
7 import random
8 import re
9 
10 from .common import InfoExtractor
11 from ..compat import (
12     compat_str,
13 )
14 from ..utils import (
15     ExtractorError,
16     float_or_none,
17     orderedSet,
18     str_or_none,
19     try_get,
20 )
21 
22 
23 class GloboIE(InfoExtractor):
24     _VALID_URL = r'(?:globo:|https?://.+?\.globo\.com/(?:[^/]+/)*(?:v/(?:[^/]+/)?|videos/))(?P<id>\d{7,})'
25     _NETRC_MACHINE = 'globo'
26     _TESTS = [{
27         'url': 'http://g1.globo.com/carros/autoesporte/videos/t/exclusivos-do-g1/v/mercedes-benz-gla-passa-por-teste-de-colisao-na-europa/3607726/',
28         'info_dict': {
29             'id': '3607726',
30             'ext': 'mp4',
31             'title': 'Mercedes-Benz GLA passa por teste de colisão na Europa',
32             'duration': 103.204,
33             'uploader': 'G1',
34             'uploader_id': '2015',
35         },
36         'params': {
37             'skip_download': True,
38         },
39     }, {
40         'url': 'http://globoplay.globo.com/v/4581987/',
41         'info_dict': {
42             'id': '4581987',
43             'ext': 'mp4',
44             'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP',
45             'duration': 137.973,
46             'uploader': 'Rede Globo',
47             'uploader_id': '196',
48         },
49         'params': {
50             'skip_download': True,
51         },
52     }, {
53         'url': 'http://canalbrasil.globo.com/programas/sangue-latino/videos/3928201.html',
54         'only_matching': True,
55     }, {
56         'url': 'http://globosatplay.globo.com/globonews/v/4472924/',
57         'only_matching': True,
58     }, {
59         'url': 'http://globotv.globo.com/t/programa/v/clipe-sexo-e-as-negas-adeus/3836166/',
60         'only_matching': True,
61     }, {
62         'url': 'http://globotv.globo.com/canal-brasil/sangue-latino/t/todos-os-videos/v/ator-e-diretor-argentino-ricado-darin-fala-sobre-utopias-e-suas-perdas/3928201/',
63         'only_matching': True,
64     }, {
65         'url': 'http://canaloff.globo.com/programas/desejar-profundo/videos/4518560.html',
66         'only_matching': True,
67     }, {
68         'url': 'globo:3607726',
69         'only_matching': True,
70     }]
71 
72     def _real_extract(self, url):
73         video_id = self._match_id(url)
74 
75         video = self._download_json(
76             'http://api.globovideos.com/videos/%s/playlist' % video_id,
77             video_id)['videos'][0]
78         if not self.get_param('allow_unplayable_formats') and video.get('encrypted') is True:
79             self.report_drm(video_id)
80 
81         title = video['title']
82 
83         formats = []
84         security = self._download_json(
85             'https://playback.video.globo.com/v1/video-session', video_id, 'Downloading security hash for %s' % video_id,
86             headers={'content-type': 'application/json'}, data=json.dumps({
87                 "player_type": "desktop",
88                 "video_id": video_id,
89                 "quality": "max",
90                 "content_protection": "widevine",
91                 "vsid": "581b986b-4c40-71f0-5a58-803e579d5fa2",
92                 "tz": "-3.0:00"
93             }).encode())
94 
95         security_hash = security['source']['token']
96         if not security_hash:
97             message = security.get('message')
98             if message:
99                 raise ExtractorError(
100                     '%s returned error: %s' % (self.IE_NAME, message), expected=True)
101 
102         hash_code = security_hash[:2]
103         padding = '%010d' % random.randint(1, 10000000000)
104         if hash_code in ('04', '14'):
105             received_time = security_hash[3:13]
106             received_md5 = security_hash[24:]
107             hash_prefix = security_hash[:23]
108         elif hash_code in ('02', '12', '03', '13'):
109             received_time = security_hash[2:12]
110             received_md5 = security_hash[22:]
111             padding += '1'
112             hash_prefix = '05' + security_hash[:22]
113 
114         padded_sign_time = compat_str(int(received_time) + 86400) + padding
115         md5_data = (received_md5 + padded_sign_time + '0xAC10FD').encode()
116         signed_md5 = base64.urlsafe_b64encode(hashlib.md5(md5_data).digest()).decode().strip('=')
117         signed_hash = hash_prefix + padded_sign_time + signed_md5
118         source = security['source']['url_parts']
119         resource_url = source['scheme'] + '://' + source['domain'] + source['path']
120         signed_url = '%s?h=%s&k=html5&a=%s' % (resource_url, signed_hash, 'F' if video.get('subscriber_only') else 'A')
121 
122         formats.extend(self._extract_m3u8_formats(
123             signed_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False))
124         self._sort_formats(formats)
125 
126         subtitles = {}
127         for resource in video['resources']:
128             if resource.get('type') == 'subtitle':
129                 subtitles.setdefault(resource.get('language') or 'por', []).append({
130                     'url': resource.get('url'),
131                 })
132         subs = try_get(security, lambda x: x['source']['subtitles'], expected_type=dict) or {}
133         for sub_lang, sub_url in subs.items():
134             if sub_url:
135                 subtitles.setdefault(sub_lang or 'por', []).append({
136                     'url': sub_url,
137                 })
138         subs = try_get(security, lambda x: x['source']['subtitles_webvtt'], expected_type=dict) or {}
139         for sub_lang, sub_url in subs.items():
140             if sub_url:
141                 subtitles.setdefault(sub_lang or 'por', []).append({
142                     'url': sub_url,
143                 })
144 
145         duration = float_or_none(video.get('duration'), 1000)
146         uploader = video.get('channel')
147         uploader_id = str_or_none(video.get('channel_id'))
148 
149         return {
150             'id': video_id,
151             'title': title,
152             'duration': duration,
153             'uploader': uploader,
154             'uploader_id': uploader_id,
155             'formats': formats,
156             'subtitles': subtitles,
157         }
158 
159 
160 class GloboArticleIE(InfoExtractor):
161     _VALID_URL = r'https?://.+?\.globo\.com/(?:[^/]+/)*(?P<id>[^/.]+)(?:\.html)?'
162 
163     _VIDEOID_REGEXES = [
164         r'\bdata-video-id=["\'](\d{7,})',
165         r'\bdata-player-videosids=["\'](\d{7,})',
166         r'\bvideosIDs\s*:\s*["\']?(\d{7,})',
167         r'\bdata-id=["\'](\d{7,})',
168         r'<div[^>]+\bid=["\'](\d{7,})',
169     ]
170 
171     _TESTS = [{
172         'url': 'http://g1.globo.com/jornal-nacional/noticia/2014/09/novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes.html',
173         'info_dict': {
174             'id': 'novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes',
175             'title': 'Novidade na fiscalização de bagagem pela Receita provoca discussões',
176             'description': 'md5:c3c4b4d4c30c32fce460040b1ac46b12',
177         },
178         'playlist_count': 1,
179     }, {
180         'url': 'http://g1.globo.com/pr/parana/noticia/2016/09/mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato.html',
181         'info_dict': {
182             'id': 'mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato',
183             'title': "Lula era o 'comandante máximo' do esquema da Lava Jato, diz MPF",
184             'description': 'md5:8aa7cc8beda4dc71cc8553e00b77c54c',
185         },
186         'playlist_count': 6,
187     }, {
188         'url': 'http://gq.globo.com/Prazeres/Poder/noticia/2015/10/all-o-desafio-assista-ao-segundo-capitulo-da-serie.html',
189         'only_matching': True,
190     }, {
191         'url': 'http://gshow.globo.com/programas/tv-xuxa/O-Programa/noticia/2014/01/xuxa-e-junno-namoram-muuuito-em-luau-de-zeze-di-camargo-e-luciano.html',
192         'only_matching': True,
193     }, {
194         'url': 'http://oglobo.globo.com/rio/a-amizade-entre-um-entregador-de-farmacia-um-piano-19946271',
195         'only_matching': True,
196     }]
197 
198     @classmethod
199     def suitable(cls, url):
200         return False if GloboIE.suitable(url) else super(GloboArticleIE, cls).suitable(url)
201 
202     def _real_extract(self, url):
203         display_id = self._match_id(url)
204         webpage = self._download_webpage(url, display_id)
205         video_ids = []
206         for video_regex in self._VIDEOID_REGEXES:
207             video_ids.extend(re.findall(video_regex, webpage))
208         entries = [
209             self.url_result('globo:%s' % video_id, GloboIE.ie_key())
210             for video_id in orderedSet(video_ids)]
211         title = self._og_search_title(webpage, fatal=False)
212         description = self._html_search_meta('description', webpage)
213         return self.playlist_result(entries, display_id, title, description)
214
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/yt_dlp/extractor/globo.py b/yt_dlp/extractor/globo.py
--- a/yt_dlp/extractor/globo.py
+++ b/yt_dlp/extractor/globo.py
@@ -12,6 +12,7 @@
     compat_str,
 )
 from ..utils import (
+    HEADRequest,
     ExtractorError,
     float_or_none,
     orderedSet,
@@ -67,11 +68,28 @@
     }, {
         'url': 'globo:3607726',
         'only_matching': True,
+    }, {
+        'url': 'https://globoplay.globo.com/v/10248083/',
+        'info_dict': {
+            'id': '10248083',
+            'ext': 'mp4',
+            'title': 'Melhores momentos: Equador 1 x 1 Brasil pelas Eliminatórias da Copa do Mundo 2022',
+            'duration': 530.964,
+            'uploader': 'SporTV',
+            'uploader_id': '698',
+        },
+        'params': {
+            'skip_download': True,
+        },
     }]
 
     def _real_extract(self, url):
         video_id = self._match_id(url)
 
+        self._request_webpage(
+            HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'),
+            video_id, 'Getting cookies')
+
         video = self._download_json(
             'http://api.globovideos.com/videos/%s/playlist' % video_id,
             video_id)['videos'][0]
@@ -82,7 +100,7 @@
 
         formats = []
         security = self._download_json(
-            'https://playback.video.globo.com/v1/video-session', video_id, 'Downloading security hash for %s' % video_id,
+            'https://playback.video.globo.com/v2/video-session', video_id, 'Downloading security hash for %s' % video_id,
             headers={'content-type': 'application/json'}, data=json.dumps({
                 "player_type": "desktop",
                 "video_id": video_id,
@@ -92,7 +110,9 @@
                 "tz": "-3.0:00"
             }).encode())
 
-        security_hash = security['source']['token']
+        self._request_webpage(HEADRequest(security['sources'][0]['url_template']), video_id, 'Getting locksession cookie')
+
+        security_hash = security['sources'][0]['token']
         if not security_hash:
             message = security.get('message')
             if message:
@@ -115,7 +135,7 @@
         md5_data = (received_md5 + padded_sign_time + '0xAC10FD').encode()
         signed_md5 = base64.urlsafe_b64encode(hashlib.md5(md5_data).digest()).decode().strip('=')
         signed_hash = hash_prefix + padded_sign_time + signed_md5
-        source = security['source']['url_parts']
+        source = security['sources'][0]['url_parts']
         resource_url = source['scheme'] + '://' + source['domain'] + source['path']
         signed_url = '%s?h=%s&k=html5&a=%s' % (resource_url, signed_hash, 'F' if video.get('subscriber_only') else 'A')

{"golden_diff": "diff --git a/yt_dlp/extractor/globo.py b/yt_dlp/extractor/globo.py\n--- a/yt_dlp/extractor/globo.py\n+++ b/yt_dlp/extractor/globo.py\n@@ -12,6 +12,7 @@\n     compat_str,\n )\n from ..utils import (\n+    HEADRequest,\n     ExtractorError,\n     float_or_none,\n     orderedSet,\n@@ -67,11 +68,28 @@\n     }, {\n         'url': 'globo:3607726',\n         'only_matching': True,\n+    }, {\n+        'url': 'https://globoplay.globo.com/v/10248083/',\n+        'info_dict': {\n+            'id': '10248083',\n+            'ext': 'mp4',\n+            'title': 'Melhores momentos: Equador 1 x 1 Brasil pelas Eliminat\u00f3rias da Copa do Mundo 2022',\n+            'duration': 530.964,\n+            'uploader': 'SporTV',\n+            'uploader_id': '698',\n+        },\n+        'params': {\n+            'skip_download': True,\n+        },\n     }]\n \n     def _real_extract(self, url):\n         video_id = self._match_id(url)\n \n+        self._request_webpage(\n+            HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'),\n+            video_id, 'Getting cookies')\n+\n         video = self._download_json(\n             'http://api.globovideos.com/videos/%s/playlist' % video_id,\n             video_id)['videos'][0]\n@@ -82,7 +100,7 @@\n \n         formats = []\n         security = self._download_json(\n-            'https://playback.video.globo.com/v1/video-session', video_id, 'Downloading security hash for %s' % video_id,\n+            'https://playback.video.globo.com/v2/video-session', video_id, 'Downloading security hash for %s' % video_id,\n             headers={'content-type': 'application/json'}, data=json.dumps({\n                 \"player_type\": \"desktop\",\n                 \"video_id\": video_id,\n@@ -92,7 +110,9 @@\n                 \"tz\": \"-3.0:00\"\n             }).encode())\n \n-        security_hash = security['source']['token']\n+        self._request_webpage(HEADRequest(security['sources'][0]['url_template']), video_id, 'Getting locksession cookie')\n+\n+        security_hash = security['sources'][0]['token']\n         if not security_hash:\n             message = security.get('message')\n             if message:\n@@ -115,7 +135,7 @@\n         md5_data = (received_md5 + padded_sign_time + '0xAC10FD').encode()\n         signed_md5 = base64.urlsafe_b64encode(hashlib.md5(md5_data).digest()).decode().strip('=')\n         signed_hash = hash_prefix + padded_sign_time + signed_md5\n-        source = security['source']['url_parts']\n+        source = security['sources'][0]['url_parts']\n         resource_url = source['scheme'] + '://' + source['domain'] + source['path']\n         signed_url = '%s?h=%s&k=html5&a=%s' % (resource_url, signed_hash, 'F' if video.get('subscriber_only') else 'A')\n", "issue": "apt doesn't keep track of latest version\n### Checklist\r\n\r\n- [X] I'm asking a question and **not** reporting a bug/feature request\r\n- [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)\r\n- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)\r\n- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar questions including closed ones\r\n\r\n### Question\r\n\r\nYesterday I came online and the first thing I did was to run `sudo apt upgrade yt-dlp`. At the time I had a version 2021-12-27 or something similar. Apt then told me I had the latest version and didn't need to upgrade,\r\n\r\nI run Linux Mint 20.3 and as it happened the gui Update Manager ran at the same time, and it told me I could upgrade to version 2022.01.21, which I did using the Upgrade Manager.\r\n\r\nI have never before experienced the Upgrade Manager telling me about an available upgrade for yt-dlp. Perhaps this is a new interaction. In any case I appreciate it since that's the most dead-sure way of catching new upgrades and being up-to-date.\r\n\r\n### Verbose log\r\n\r\n_No response_\n", "before_files": [{"content": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nimport base64\nimport hashlib\nimport json\nimport random\nimport re\n\nfrom .common import InfoExtractor\nfrom ..compat import (\n    compat_str,\n)\nfrom ..utils import (\n    ExtractorError,\n    float_or_none,\n    orderedSet,\n    str_or_none,\n    try_get,\n)\n\n\nclass GloboIE(InfoExtractor):\n    _VALID_URL = r'(?:globo:|https?://.+?\\.globo\\.com/(?:[^/]+/)*(?:v/(?:[^/]+/)?|videos/))(?P<id>\\d{7,})'\n    _NETRC_MACHINE = 'globo'\n    _TESTS = [{\n        'url': 'http://g1.globo.com/carros/autoesporte/videos/t/exclusivos-do-g1/v/mercedes-benz-gla-passa-por-teste-de-colisao-na-europa/3607726/',\n        'info_dict': {\n            'id': '3607726',\n            'ext': 'mp4',\n            'title': 'Mercedes-Benz GLA passa por teste de colis\u00e3o na Europa',\n            'duration': 103.204,\n            'uploader': 'G1',\n            'uploader_id': '2015',\n        },\n        'params': {\n            'skip_download': True,\n        },\n    }, {\n        'url': 'http://globoplay.globo.com/v/4581987/',\n        'info_dict': {\n            'id': '4581987',\n            'ext': 'mp4',\n            'title': 'Acidentes de tr\u00e2nsito est\u00e3o entre as maiores causas de queda de energia em SP',\n            'duration': 137.973,\n            'uploader': 'Rede Globo',\n            'uploader_id': '196',\n        },\n        'params': {\n            'skip_download': True,\n        },\n    }, {\n        'url': 'http://canalbrasil.globo.com/programas/sangue-latino/videos/3928201.html',\n        'only_matching': True,\n    }, {\n        'url': 'http://globosatplay.globo.com/globonews/v/4472924/',\n        'only_matching': True,\n    }, {\n        'url': 'http://globotv.globo.com/t/programa/v/clipe-sexo-e-as-negas-adeus/3836166/',\n        'only_matching': True,\n    }, {\n        'url': 'http://globotv.globo.com/canal-brasil/sangue-latino/t/todos-os-videos/v/ator-e-diretor-argentino-ricado-darin-fala-sobre-utopias-e-suas-perdas/3928201/',\n        'only_matching': True,\n    }, {\n        'url': 'http://canaloff.globo.com/programas/desejar-profundo/videos/4518560.html',\n        'only_matching': True,\n    }, {\n        'url': 'globo:3607726',\n        'only_matching': True,\n    }]\n\n    def _real_extract(self, url):\n        video_id = self._match_id(url)\n\n        video = self._download_json(\n            'http://api.globovideos.com/videos/%s/playlist' % video_id,\n            video_id)['videos'][0]\n        if not self.get_param('allow_unplayable_formats') and video.get('encrypted') is True:\n            self.report_drm(video_id)\n\n        title = video['title']\n\n        formats = []\n        security = self._download_json(\n            'https://playback.video.globo.com/v1/video-session', video_id, 'Downloading security hash for %s' % video_id,\n            headers={'content-type': 'application/json'}, data=json.dumps({\n                \"player_type\": \"desktop\",\n                \"video_id\": video_id,\n                \"quality\": \"max\",\n                \"content_protection\": \"widevine\",\n                \"vsid\": \"581b986b-4c40-71f0-5a58-803e579d5fa2\",\n                \"tz\": \"-3.0:00\"\n            }).encode())\n\n        security_hash = security['source']['token']\n        if not security_hash:\n            message = security.get('message')\n            if message:\n                raise ExtractorError(\n                    '%s returned error: %s' % (self.IE_NAME, message), expected=True)\n\n        hash_code = security_hash[:2]\n        padding = '%010d' % random.randint(1, 10000000000)\n        if hash_code in ('04', '14'):\n            received_time = security_hash[3:13]\n            received_md5 = security_hash[24:]\n            hash_prefix = security_hash[:23]\n        elif hash_code in ('02', '12', '03', '13'):\n            received_time = security_hash[2:12]\n            received_md5 = security_hash[22:]\n            padding += '1'\n            hash_prefix = '05' + security_hash[:22]\n\n        padded_sign_time = compat_str(int(received_time) + 86400) + padding\n        md5_data = (received_md5 + padded_sign_time + '0xAC10FD').encode()\n        signed_md5 = base64.urlsafe_b64encode(hashlib.md5(md5_data).digest()).decode().strip('=')\n        signed_hash = hash_prefix + padded_sign_time + signed_md5\n        source = security['source']['url_parts']\n        resource_url = source['scheme'] + '://' + source['domain'] + source['path']\n        signed_url = '%s?h=%s&k=html5&a=%s' % (resource_url, signed_hash, 'F' if video.get('subscriber_only') else 'A')\n\n        formats.extend(self._extract_m3u8_formats(\n            signed_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False))\n        self._sort_formats(formats)\n\n        subtitles = {}\n        for resource in video['resources']:\n            if resource.get('type') == 'subtitle':\n                subtitles.setdefault(resource.get('language') or 'por', []).append({\n                    'url': resource.get('url'),\n                })\n        subs = try_get(security, lambda x: x['source']['subtitles'], expected_type=dict) or {}\n        for sub_lang, sub_url in subs.items():\n            if sub_url:\n                subtitles.setdefault(sub_lang or 'por', []).append({\n                    'url': sub_url,\n                })\n        subs = try_get(security, lambda x: x['source']['subtitles_webvtt'], expected_type=dict) or {}\n        for sub_lang, sub_url in subs.items():\n            if sub_url:\n                subtitles.setdefault(sub_lang or 'por', []).append({\n                    'url': sub_url,\n                })\n\n        duration = float_or_none(video.get('duration'), 1000)\n        uploader = video.get('channel')\n        uploader_id = str_or_none(video.get('channel_id'))\n\n        return {\n            'id': video_id,\n            'title': title,\n            'duration': duration,\n            'uploader': uploader,\n            'uploader_id': uploader_id,\n            'formats': formats,\n            'subtitles': subtitles,\n        }\n\n\nclass GloboArticleIE(InfoExtractor):\n    _VALID_URL = r'https?://.+?\\.globo\\.com/(?:[^/]+/)*(?P<id>[^/.]+)(?:\\.html)?'\n\n    _VIDEOID_REGEXES = [\n        r'\\bdata-video-id=[\"\\'](\\d{7,})',\n        r'\\bdata-player-videosids=[\"\\'](\\d{7,})',\n        r'\\bvideosIDs\\s*:\\s*[\"\\']?(\\d{7,})',\n        r'\\bdata-id=[\"\\'](\\d{7,})',\n        r'<div[^>]+\\bid=[\"\\'](\\d{7,})',\n    ]\n\n    _TESTS = [{\n        'url': 'http://g1.globo.com/jornal-nacional/noticia/2014/09/novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes.html',\n        'info_dict': {\n            'id': 'novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes',\n            'title': 'Novidade na fiscaliza\u00e7\u00e3o de bagagem pela Receita provoca discuss\u00f5es',\n            'description': 'md5:c3c4b4d4c30c32fce460040b1ac46b12',\n        },\n        'playlist_count': 1,\n    }, {\n        'url': 'http://g1.globo.com/pr/parana/noticia/2016/09/mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato.html',\n        'info_dict': {\n            'id': 'mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato',\n            'title': \"Lula era o 'comandante m\u00e1ximo' do esquema da Lava Jato, diz MPF\",\n            'description': 'md5:8aa7cc8beda4dc71cc8553e00b77c54c',\n        },\n        'playlist_count': 6,\n    }, {\n        'url': 'http://gq.globo.com/Prazeres/Poder/noticia/2015/10/all-o-desafio-assista-ao-segundo-capitulo-da-serie.html',\n        'only_matching': True,\n    }, {\n        'url': 'http://gshow.globo.com/programas/tv-xuxa/O-Programa/noticia/2014/01/xuxa-e-junno-namoram-muuuito-em-luau-de-zeze-di-camargo-e-luciano.html',\n        'only_matching': True,\n    }, {\n        'url': 'http://oglobo.globo.com/rio/a-amizade-entre-um-entregador-de-farmacia-um-piano-19946271',\n        'only_matching': True,\n    }]\n\n    @classmethod\n    def suitable(cls, url):\n        return False if GloboIE.suitable(url) else super(GloboArticleIE, cls).suitable(url)\n\n    def _real_extract(self, url):\n        display_id = self._match_id(url)\n        webpage = self._download_webpage(url, display_id)\n        video_ids = []\n        for video_regex in self._VIDEOID_REGEXES:\n            video_ids.extend(re.findall(video_regex, webpage))\n        entries = [\n            self.url_result('globo:%s' % video_id, GloboIE.ie_key())\n            for video_id in orderedSet(video_ids)]\n        title = self._og_search_title(webpage, fatal=False)\n        description = self._html_search_meta('description', webpage)\n        return self.playlist_result(entries, display_id, title, description)\n", "path": "yt_dlp/extractor/globo.py"}], "after_files": [{"content": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nimport base64\nimport hashlib\nimport json\nimport random\nimport re\n\nfrom .common import InfoExtractor\nfrom ..compat import (\n    compat_str,\n)\nfrom ..utils import (\n    HEADRequest,\n    ExtractorError,\n    float_or_none,\n    orderedSet,\n    str_or_none,\n    try_get,\n)\n\n\nclass GloboIE(InfoExtractor):\n    _VALID_URL = r'(?:globo:|https?://.+?\\.globo\\.com/(?:[^/]+/)*(?:v/(?:[^/]+/)?|videos/))(?P<id>\\d{7,})'\n    _NETRC_MACHINE = 'globo'\n    _TESTS = [{\n        'url': 'http://g1.globo.com/carros/autoesporte/videos/t/exclusivos-do-g1/v/mercedes-benz-gla-passa-por-teste-de-colisao-na-europa/3607726/',\n        'info_dict': {\n            'id': '3607726',\n            'ext': 'mp4',\n            'title': 'Mercedes-Benz GLA passa por teste de colis\u00e3o na Europa',\n            'duration': 103.204,\n            'uploader': 'G1',\n            'uploader_id': '2015',\n        },\n        'params': {\n            'skip_download': True,\n        },\n    }, {\n        'url': 'http://globoplay.globo.com/v/4581987/',\n        'info_dict': {\n            'id': '4581987',\n            'ext': 'mp4',\n            'title': 'Acidentes de tr\u00e2nsito est\u00e3o entre as maiores causas de queda de energia em SP',\n            'duration': 137.973,\n            'uploader': 'Rede Globo',\n            'uploader_id': '196',\n        },\n        'params': {\n            'skip_download': True,\n        },\n    }, {\n        'url': 'http://canalbrasil.globo.com/programas/sangue-latino/videos/3928201.html',\n        'only_matching': True,\n    }, {\n        'url': 'http://globosatplay.globo.com/globonews/v/4472924/',\n        'only_matching': True,\n    }, {\n        'url': 'http://globotv.globo.com/t/programa/v/clipe-sexo-e-as-negas-adeus/3836166/',\n        'only_matching': True,\n    }, {\n        'url': 'http://globotv.globo.com/canal-brasil/sangue-latino/t/todos-os-videos/v/ator-e-diretor-argentino-ricado-darin-fala-sobre-utopias-e-suas-perdas/3928201/',\n        'only_matching': True,\n    }, {\n        'url': 'http://canaloff.globo.com/programas/desejar-profundo/videos/4518560.html',\n        'only_matching': True,\n    }, {\n        'url': 'globo:3607726',\n        'only_matching': True,\n    }, {\n        'url': 'https://globoplay.globo.com/v/10248083/',\n        'info_dict': {\n            'id': '10248083',\n            'ext': 'mp4',\n            'title': 'Melhores momentos: Equador 1 x 1 Brasil pelas Eliminat\u00f3rias da Copa do Mundo 2022',\n            'duration': 530.964,\n            'uploader': 'SporTV',\n            'uploader_id': '698',\n        },\n        'params': {\n            'skip_download': True,\n        },\n    }]\n\n    def _real_extract(self, url):\n        video_id = self._match_id(url)\n\n        self._request_webpage(\n            HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'),\n            video_id, 'Getting cookies')\n\n        video = self._download_json(\n            'http://api.globovideos.com/videos/%s/playlist' % video_id,\n            video_id)['videos'][0]\n        if not self.get_param('allow_unplayable_formats') and video.get('encrypted') is True:\n            self.report_drm(video_id)\n\n        title = video['title']\n\n        formats = []\n        security = self._download_json(\n            'https://playback.video.globo.com/v2/video-session', video_id, 'Downloading security hash for %s' % video_id,\n            headers={'content-type': 'application/json'}, data=json.dumps({\n                \"player_type\": \"desktop\",\n                \"video_id\": video_id,\n                \"quality\": \"max\",\n                \"content_protection\": \"widevine\",\n                \"vsid\": \"581b986b-4c40-71f0-5a58-803e579d5fa2\",\n                \"tz\": \"-3.0:00\"\n            }).encode())\n\n        self._request_webpage(HEADRequest(security['sources'][0]['url_template']), video_id, 'Getting locksession cookie')\n\n        security_hash = security['sources'][0]['token']\n        if not security_hash:\n            message = security.get('message')\n            if message:\n                raise ExtractorError(\n                    '%s returned error: %s' % (self.IE_NAME, message), expected=True)\n\n        hash_code = security_hash[:2]\n        padding = '%010d' % random.randint(1, 10000000000)\n        if hash_code in ('04', '14'):\n            received_time = security_hash[3:13]\n            received_md5 = security_hash[24:]\n            hash_prefix = security_hash[:23]\n        elif hash_code in ('02', '12', '03', '13'):\n            received_time = security_hash[2:12]\n            received_md5 = security_hash[22:]\n            padding += '1'\n            hash_prefix = '05' + security_hash[:22]\n\n        padded_sign_time = compat_str(int(received_time) + 86400) + padding\n        md5_data = (received_md5 + padded_sign_time + '0xAC10FD').encode()\n        signed_md5 = base64.urlsafe_b64encode(hashlib.md5(md5_data).digest()).decode().strip('=')\n        signed_hash = hash_prefix + padded_sign_time + signed_md5\n        source = security['sources'][0]['url_parts']\n        resource_url = source['scheme'] + '://' + source['domain'] + source['path']\n        signed_url = '%s?h=%s&k=html5&a=%s' % (resource_url, signed_hash, 'F' if video.get('subscriber_only') else 'A')\n\n        formats.extend(self._extract_m3u8_formats(\n            signed_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False))\n        self._sort_formats(formats)\n\n        subtitles = {}\n        for resource in video['resources']:\n            if resource.get('type') == 'subtitle':\n                subtitles.setdefault(resource.get('language') or 'por', []).append({\n                    'url': resource.get('url'),\n                })\n        subs = try_get(security, lambda x: x['source']['subtitles'], expected_type=dict) or {}\n        for sub_lang, sub_url in subs.items():\n            if sub_url:\n                subtitles.setdefault(sub_lang or 'por', []).append({\n                    'url': sub_url,\n                })\n        subs = try_get(security, lambda x: x['source']['subtitles_webvtt'], expected_type=dict) or {}\n        for sub_lang, sub_url in subs.items():\n            if sub_url:\n                subtitles.setdefault(sub_lang or 'por', []).append({\n                    'url': sub_url,\n                })\n\n        duration = float_or_none(video.get('duration'), 1000)\n        uploader = video.get('channel')\n        uploader_id = str_or_none(video.get('channel_id'))\n\n        return {\n            'id': video_id,\n            'title': title,\n            'duration': duration,\n            'uploader': uploader,\n            'uploader_id': uploader_id,\n            'formats': formats,\n            'subtitles': subtitles,\n        }\n\n\nclass GloboArticleIE(InfoExtractor):\n    _VALID_URL = r'https?://.+?\\.globo\\.com/(?:[^/]+/)*(?P<id>[^/.]+)(?:\\.html)?'\n\n    _VIDEOID_REGEXES = [\n        r'\\bdata-video-id=[\"\\'](\\d{7,})',\n        r'\\bdata-player-videosids=[\"\\'](\\d{7,})',\n        r'\\bvideosIDs\\s*:\\s*[\"\\']?(\\d{7,})',\n        r'\\bdata-id=[\"\\'](\\d{7,})',\n        r'<div[^>]+\\bid=[\"\\'](\\d{7,})',\n    ]\n\n    _TESTS = [{\n        'url': 'http://g1.globo.com/jornal-nacional/noticia/2014/09/novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes.html',\n        'info_dict': {\n            'id': 'novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes',\n            'title': 'Novidade na fiscaliza\u00e7\u00e3o de bagagem pela Receita provoca discuss\u00f5es',\n            'description': 'md5:c3c4b4d4c30c32fce460040b1ac46b12',\n        },\n        'playlist_count': 1,\n    }, {\n        'url': 'http://g1.globo.com/pr/parana/noticia/2016/09/mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato.html',\n        'info_dict': {\n            'id': 'mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato',\n            'title': \"Lula era o 'comandante m\u00e1ximo' do esquema da Lava Jato, diz MPF\",\n            'description': 'md5:8aa7cc8beda4dc71cc8553e00b77c54c',\n        },\n        'playlist_count': 6,\n    }, {\n        'url': 'http://gq.globo.com/Prazeres/Poder/noticia/2015/10/all-o-desafio-assista-ao-segundo-capitulo-da-serie.html',\n        'only_matching': True,\n    }, {\n        'url': 'http://gshow.globo.com/programas/tv-xuxa/O-Programa/noticia/2014/01/xuxa-e-junno-namoram-muuuito-em-luau-de-zeze-di-camargo-e-luciano.html',\n        'only_matching': True,\n    }, {\n        'url': 'http://oglobo.globo.com/rio/a-amizade-entre-um-entregador-de-farmacia-um-piano-19946271',\n        'only_matching': True,\n    }]\n\n    @classmethod\n    def suitable(cls, url):\n        return False if GloboIE.suitable(url) else super(GloboArticleIE, cls).suitable(url)\n\n    def _real_extract(self, url):\n        display_id = self._match_id(url)\n        webpage = self._download_webpage(url, display_id)\n        video_ids = []\n        for video_regex in self._VIDEOID_REGEXES:\n            video_ids.extend(re.findall(video_regex, webpage))\n        entries = [\n            self.url_result('globo:%s' % video_id, GloboIE.ie_key())\n            for video_id in orderedSet(video_ids)]\n        title = self._og_search_title(webpage, fatal=False)\n        description = self._html_search_meta('description', webpage)\n        return self.playlist_result(entries, display_id, title, description)\n", "path": "yt_dlp/extractor/globo.py"}]}