]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/streetvoice.py
[ie/generic] Add `key_query` extractor-arg
[yt-dlp.git] / yt_dlp / extractor / streetvoice.py
index f21681ae784ac4d4e4fd569449f2b80a4d9375f9..60056f7cbfeddc94496e1a6a7d410ae871524e13 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 from .common import InfoExtractor
 from ..utils import (
     int_or_none,
@@ -36,7 +33,7 @@ class StreetVoiceIE(InfoExtractor):
             'track': '流浪',
             'track_id': '123688',
             'album': '2010',
-        }
+        },
     }, {
         'url': 'http://tw.streetvoice.com/skippylu/songs/94440/',
         'only_matching': True,
@@ -44,7 +41,7 @@ class StreetVoiceIE(InfoExtractor):
 
     def _real_extract(self, url):
         song_id = self._match_id(url)
-        base_url = 'https://streetvoice.com/api/v4/song/%s/' % song_id
+        base_url = f'https://streetvoice.com/api/v4/song/{song_id}/'
         song = self._download_json(base_url, song_id, query={
             'fields': 'album,comments_count,created_at,id,image,length,likes_count,name,nickname,plays_count,profile,share_count,synopsis,user,username',
         })
@@ -54,7 +51,7 @@ def _real_extract(self, url):
         for suffix, format_id in [('hls/file', 'hls'), ('file', 'http'), ('file/original', 'original')]:
             f_url = (self._download_json(
                 base_url + suffix + '/', song_id,
-                'Downloading %s format URL' % format_id,
+                f'Downloading {format_id} format URL',
                 data=b'', fatal=False) or {}).get('file')
             if not f_url:
                 continue
@@ -89,7 +86,7 @@ def _real_extract(self, url):
             'timestamp': parse_iso8601(song.get('created_at')),
             'uploader': try_get(user, lambda x: x['profile']['nickname']),
             'uploader_id': str_or_none(user.get('id')),
-            'uploader_url': urljoin(url, '/%s/' % username) if username else None,
+            'uploader_url': urljoin(url, f'/{username}/') if username else None,
             'view_count': get_count('plays'),
             'like_count': get_count('likes'),
             'comment_count': get_count('comments'),