1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 08:35:32 +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:
sepro
2024-06-12 01:09:58 +02:00
committed by GitHub
parent db50f19d76
commit add96eb9f8
915 changed files with 7027 additions and 7246 deletions

View File

@ -19,7 +19,7 @@ class StanfordOpenClassroomIE(InfoExtractor):
'id': 'PracticalUnix_intro-environment',
'ext': 'mp4',
'title': 'Intro Environment',
}
},
}
def _real_extract(self, url):
@ -34,12 +34,12 @@ class StanfordOpenClassroomIE(InfoExtractor):
'upload_date': None,
}
baseUrl = 'http://openclassroom.stanford.edu/MainFolder/courses/' + course + '/videos/'
xmlUrl = baseUrl + video + '.xml'
mdoc = self._download_xml(xmlUrl, info['id'])
base_url = 'http://openclassroom.stanford.edu/MainFolder/courses/' + course + '/videos/'
xml_url = base_url + video + '.xml'
mdoc = self._download_xml(xml_url, info['id'])
try:
info['title'] = mdoc.findall('./title')[0].text
info['url'] = baseUrl + mdoc.findall('./videoFile')[0].text
info['url'] = base_url + mdoc.findall('./videoFile')[0].text
except IndexError:
raise ExtractorError('Invalid metadata XML file')
return info
@ -66,7 +66,7 @@ class StanfordOpenClassroomIE(InfoExtractor):
links = orderedSet(re.findall(r'<a href="(VideoPage\.php\?[^"]+)">', coursepage))
info['entries'] = [self.url_result(
'http://openclassroom.stanford.edu/MainFolder/%s' % unescapeHTML(l)
f'http://openclassroom.stanford.edu/MainFolder/{unescapeHTML(l)}',
) for l in links]
return info
else: # Root page
@ -78,12 +78,12 @@ class StanfordOpenClassroomIE(InfoExtractor):
}
info['title'] = info['id']
rootURL = 'http://openclassroom.stanford.edu/MainFolder/HomePage.php'
rootpage = self._download_webpage(rootURL, info['id'],
root_url = 'http://openclassroom.stanford.edu/MainFolder/HomePage.php'
rootpage = self._download_webpage(root_url, info['id'],
errnote='Unable to download course info page')
links = orderedSet(re.findall(r'<a href="(CoursePage\.php\?[^"]+)">', rootpage))
info['entries'] = [self.url_result(
'http://openclassroom.stanford.edu/MainFolder/%s' % unescapeHTML(l)
f'http://openclassroom.stanford.edu/MainFolder/{unescapeHTML(l)}',
) for l in links]
return info