]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/mit.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / mit.py
index e1506a745a69e6c300f1e36cdc6b3e4ed8206bf0..e75c540a23e558d8a4f61c946580f2f192cc218c 100644 (file)
@@ -1,13 +1,11 @@
-from __future__ import unicode_literals
-
-import re
 import json
+import re
 
 from .common import InfoExtractor
 from .youtube import YoutubeIE
 from ..utils import (
-    clean_html,
     ExtractorError,
+    clean_html,
     get_element_by_id,
 )
 
@@ -30,7 +28,7 @@ class TechTVMITIE(InfoExtractor):
     def _real_extract(self, url):
         video_id = self._match_id(url)
         raw_page = self._download_webpage(
-            'http://techtv.mit.edu/videos/%s' % video_id, video_id)
+            f'http://techtv.mit.edu/videos/{video_id}', video_id)
         clean_page = re.compile(r'<!--.*?-->', re.S).sub('', raw_page)
 
         base_url = self._proto_relative_url(self._search_regex(
@@ -81,7 +79,7 @@ class OCWMITIE(InfoExtractor):
                 'upload_date': '20121109',
                 'uploader_id': 'MIT',
                 'uploader': 'MIT OpenCourseWare',
-            }
+            },
         },
         {
             'url': 'http://ocw.mit.edu/courses/mathematics/18-01sc-single-variable-calculus-fall-2010/1.-differentiation/part-a-definition-and-basic-rules/session-1-introduction-to-derivatives/',
@@ -93,12 +91,12 @@ class OCWMITIE(InfoExtractor):
                 'uploader_id': 'MIT',
                 'uploader': 'MIT OpenCourseWare',
                 'description': 'This section contains lecture video excerpts, lecture notes, an interactive mathlet with supporting documents, and problem solving videos.',
-            }
-        }
+            },
+        },
     ]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         topic = mobj.group('topic')
 
         webpage = self._download_webpage(url, topic)