1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-09 03:16:06 +08:00

Simplify example

This commit is contained in:
Kyle 2019-08-01 10:19:49 +09:00
parent 2590fb724f
commit 9ecf3eee2d

View File

@ -375,22 +375,15 @@ Extracting variables is acceptable for reducing code duplication and improving r
Correct: Correct:
```python ```python
return self.playlist_result( title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, 'title')
[self._parse_brightcove_metadata(vid, vid.get('id'), headers)
for vid in json_data.get('videos', []) if vid.get('id')],
json_data.get('id'), json_data.get('name'),
json_data.get('description'))
``` ```
Incorrect: Incorrect:
```python ```python
id = json_data.get('id') TITLE_RE = r'<title>([^<]+)</title>'
# ...some lines of code...
return self.playlist_result( title = self._html_search_regex(TITLE_RE, webpage, 'title')
[self._parse_brightcove_metadata(vid, vid.get('id'), headers)
for vid in json_data.get('videos', []) if vid.get('id')],
id, json_data.get('name'), json_data.get('description'))
``` ```
### Collapse fallbacks ### Collapse fallbacks