mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 00:25:15 +00:00 
			
		
		
		
	Update to ytdl-commit-a803582
[peertube] only call description endpoint if necessary
a803582717
			
			
This commit is contained in:
		@@ -569,15 +569,15 @@ class PeerTubeIE(InfoExtractor):
 | 
				
			|||||||
            formats.append(f)
 | 
					            formats.append(f)
 | 
				
			||||||
        self._sort_formats(formats)
 | 
					        self._sort_formats(formats)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        full_description = self._call_api(
 | 
					        description = video.get('description')
 | 
				
			||||||
            host, video_id, 'description', note='Downloading description JSON',
 | 
					        if len(description) >= 250:
 | 
				
			||||||
            fatal=False)
 | 
					            # description is shortened
 | 
				
			||||||
 | 
					            full_description = self._call_api(
 | 
				
			||||||
 | 
					                host, video_id, 'description', note='Downloading description JSON',
 | 
				
			||||||
 | 
					                fatal=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        description = None
 | 
					            if isinstance(full_description, dict):
 | 
				
			||||||
        if isinstance(full_description, dict):
 | 
					                description = str_or_none(full_description.get('description')) or description
 | 
				
			||||||
            description = str_or_none(full_description.get('description'))
 | 
					 | 
				
			||||||
        if not description:
 | 
					 | 
				
			||||||
            description = video.get('description')
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        subtitles = self.extract_subtitles(host, video_id)
 | 
					        subtitles = self.extract_subtitles(host, video_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,6 +12,10 @@ from ..utils import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PeriscopeBaseIE(InfoExtractor):
 | 
					class PeriscopeBaseIE(InfoExtractor):
 | 
				
			||||||
 | 
					    _M3U8_HEADERS = {
 | 
				
			||||||
 | 
					        'Referer': 'https://www.periscope.tv/'
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _call_api(self, method, query, item_id):
 | 
					    def _call_api(self, method, query, item_id):
 | 
				
			||||||
        return self._download_json(
 | 
					        return self._download_json(
 | 
				
			||||||
            'https://api.periscope.tv/api/v2/%s' % method,
 | 
					            'https://api.periscope.tv/api/v2/%s' % method,
 | 
				
			||||||
@@ -54,9 +58,11 @@ class PeriscopeBaseIE(InfoExtractor):
 | 
				
			|||||||
            m3u8_url, video_id, 'mp4',
 | 
					            m3u8_url, video_id, 'mp4',
 | 
				
			||||||
            entry_protocol='m3u8_native'
 | 
					            entry_protocol='m3u8_native'
 | 
				
			||||||
            if state in ('ended', 'timed_out') else 'm3u8',
 | 
					            if state in ('ended', 'timed_out') else 'm3u8',
 | 
				
			||||||
            m3u8_id=format_id, fatal=fatal)
 | 
					            m3u8_id=format_id, fatal=fatal, headers=self._M3U8_HEADERS)
 | 
				
			||||||
        if len(m3u8_formats) == 1:
 | 
					        if len(m3u8_formats) == 1:
 | 
				
			||||||
            self._add_width_and_height(m3u8_formats[0], width, height)
 | 
					            self._add_width_and_height(m3u8_formats[0], width, height)
 | 
				
			||||||
 | 
					        for f in m3u8_formats:
 | 
				
			||||||
 | 
					            f.setdefault('http_headers', {}).update(self._M3U8_HEADERS)
 | 
				
			||||||
        return m3u8_formats
 | 
					        return m3u8_formats
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user