mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	[cleanup] Add more ruff rules (#10149)
Authored by: seproDev Reviewed-by: bashonly <88596187+bashonly@users.noreply.github.com> Reviewed-by: Simon Sawicki <contact@grub4k.xyz>
This commit is contained in:
		| @@ -1,10 +1,7 @@ | ||||
| import re | ||||
| import urllib.parse | ||||
| 
 | ||||
| from .common import InfoExtractor | ||||
| from ..compat import ( | ||||
|     compat_str, | ||||
|     compat_urlparse, | ||||
| ) | ||||
| from ..networking.exceptions import HTTPError | ||||
| from ..utils import ( | ||||
|     ExtractorError, | ||||
| @@ -124,13 +121,13 @@ class ViideaIE(InfoExtractor): | ||||
|              r'cfg\s*:\s*({[^}]+})'], | ||||
|             webpage, 'cfg'), lecture_slug, js_to_json) | ||||
| 
 | ||||
|         lecture_id = compat_str(cfg['obj_id']) | ||||
|         lecture_id = str(cfg['obj_id']) | ||||
| 
 | ||||
|         base_url = self._proto_relative_url(cfg['livepipe'], 'http:') | ||||
| 
 | ||||
|         try: | ||||
|             lecture_data = self._download_json( | ||||
|                 '%s/site/api/lecture/%s?format=json' % (base_url, lecture_id), | ||||
|                 f'{base_url}/site/api/lecture/{lecture_id}?format=json', | ||||
|                 lecture_id)['lecture'][0] | ||||
|         except ExtractorError as e: | ||||
|             if isinstance(e.cause, HTTPError) and e.cause.status == 403: | ||||
| @@ -150,18 +147,18 @@ class ViideaIE(InfoExtractor): | ||||
| 
 | ||||
|         playlist_entries = [] | ||||
|         lecture_type = lecture_data.get('type') | ||||
|         parts = [compat_str(video) for video in cfg.get('videos', [])] | ||||
|         parts = [str(video) for video in cfg.get('videos', [])] | ||||
|         if parts: | ||||
|             multipart = len(parts) > 1 | ||||
| 
 | ||||
|             def extract_part(part_id): | ||||
|                 smil_url = '%s/%s/video/%s/smil.xml' % (base_url, lecture_slug, part_id) | ||||
|                 smil_url = f'{base_url}/{lecture_slug}/video/{part_id}/smil.xml' | ||||
|                 smil = self._download_smil(smil_url, lecture_id) | ||||
|                 info = self._parse_smil(smil, smil_url, lecture_id) | ||||
|                 info['id'] = lecture_id if not multipart else '%s_part%s' % (lecture_id, part_id) | ||||
|                 info['display_id'] = lecture_slug if not multipart else '%s_part%s' % (lecture_slug, part_id) | ||||
|                 info['id'] = lecture_id if not multipart else f'{lecture_id}_part{part_id}' | ||||
|                 info['display_id'] = lecture_slug if not multipart else f'{lecture_slug}_part{part_id}' | ||||
|                 if multipart: | ||||
|                     info['title'] += ' (Part %s)' % part_id | ||||
|                     info['title'] += f' (Part {part_id})' | ||||
|                 switch = smil.find('.//switch') | ||||
|                 if switch is not None: | ||||
|                     info['duration'] = parse_duration(switch.attrib.get('dur')) | ||||
| @@ -187,9 +184,9 @@ class ViideaIE(InfoExtractor): | ||||
|         # It's probably a playlist | ||||
|         if not parts or lecture_type == 'evt': | ||||
|             playlist_webpage = self._download_webpage( | ||||
|                 '%s/site/ajax/drilldown/?id=%s' % (base_url, lecture_id), lecture_id) | ||||
|                 f'{base_url}/site/ajax/drilldown/?id={lecture_id}', lecture_id) | ||||
|             entries = [ | ||||
|                 self.url_result(compat_urlparse.urljoin(url, video_url), 'Viidea') | ||||
|                 self.url_result(urllib.parse.urljoin(url, video_url), 'Viidea') | ||||
|                 for _, video_url in re.findall( | ||||
|                     r'<a[^>]+href=(["\'])(.+?)\1[^>]+id=["\']lec=\d+', playlist_webpage)] | ||||
|             playlist_entries.extend(entries) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sepro
					sepro