]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/traileraddict.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / traileraddict.py
index 747370d12d7fc8fd1c66b1ac101db0ba01c963e5..81c9365585c06ad62dfdcc2236e3febf39c33968 100644 (file)
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
 import re
 
 from .common import InfoExtractor
@@ -16,16 +14,15 @@ class TrailerAddictIE(InfoExtractor):
             'ext': 'mp4',
             'title': 'Prince Avalanche Trailer',
             'description': 'Trailer for Prince Avalanche.\n\nTwo highway road workers spend the summer of 1988 away from their city lives. The isolated landscape becomes a place of misadventure as the men find themselves at odds with each other and the women they left behind.',
-        }
+        },
     }
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         name = mobj.group('movie') + '/' + mobj.group('trailer_name')
         webpage = self._download_webpage(url, name)
 
-        title = self._search_regex(r'<title>(.+?)</title>',
-                                   webpage, 'video title').replace(' - Trailer Addict', '')
+        title = self._html_extract_title(webpage, 'video title').replace(' - Trailer Addict', '')
         view_count_str = self._search_regex(
             r'<span class="views_n">([0-9,.]+)</span>',
             webpage, 'view count', fatal=False)
@@ -42,7 +39,7 @@ def _real_extract(self, url):
         else:
             fvar = 'fvar'
 
-        info_url = 'http://www.traileraddict.com/%s.php?tid=%s' % (fvar, str(video_id))
+        info_url = f'http://www.traileraddict.com/{fvar}.php?tid={video_id!s}'
         info_webpage = self._download_webpage(info_url, video_id, 'Downloading the info webpage')
 
         final_url = self._search_regex(r'&fileurl=(.+)',