from .common import InfoExtractor
-from ..compat import compat_str
from ..utils import (
clean_html,
format_field,
api_url = 'https://www.minds.com/api/' + path
token = self._get_cookies(api_url).get('XSRF-TOKEN')
return self._download_json(
- api_url, video_id, 'Downloading %s JSON metadata' % resource, headers={
+ api_url, video_id, f'Downloading {resource} JSON metadata', headers={
'Referer': 'https://www.minds.com/',
'X-XSRF-TOKEN': token.value if token else '',
}, query=query)
else:
return self.url_result(entity['perma_url'])
else:
- assert(entity['subtype'] == 'video')
+ assert entity['subtype'] == 'video'
video_id = entity_id
# 1080p and webm formats available only on the sources array
video = self._call_api(
'height': int_or_none(source.get('size')),
'url': src,
})
- self._sort_formats(formats)
entity = video.get('entity') or entity
owner = entity.get('ownerObj') or {}
uploader_id = owner.get('username')
tags = entity.get('tags')
- if tags and isinstance(tags, compat_str):
+ if tags and isinstance(tags, str):
tags = [tags]
thumbnail = None
if poster:
urlh = self._request_webpage(poster, video_id, fatal=False)
if urlh:
- thumbnail = urlh.geturl()
+ thumbnail = urlh.url
return {
'id': video_id,
i = 1
while True:
data = self._call_api(
- 'v2/feeds/container/%s/videos' % feed_id,
- feed_id, 'page %s' % i, query)
+ f'v2/feeds/container/{feed_id}/videos',
+ feed_id, f'page {i}', query)
entities = data.get('entities') or []
for entity in entities:
guid = entity.get('guid')
def _real_extract(self, url):
feed_id = self._match_id(url)
feed = self._call_api(
- 'v1/%s/%s' % (self._FEED_PATH, feed_id),
+ f'v1/{self._FEED_PATH}/{feed_id}',
feed_id, self._FEED_TYPE)[self._FEED_TYPE]
return self.playlist_result(