mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-02 04:12:52 +08:00
Simplify example
This commit is contained in:
parent
2590fb724f
commit
9ecf3eee2d
@ -375,22 +375,15 @@ Extracting variables is acceptable for reducing code duplication and improving r
|
||||
Correct:
|
||||
|
||||
```python
|
||||
return self.playlist_result(
|
||||
[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'))
|
||||
title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, 'title')
|
||||
```
|
||||
|
||||
Incorrect:
|
||||
|
||||
```python
|
||||
id = json_data.get('id')
|
||||
|
||||
return self.playlist_result(
|
||||
[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'))
|
||||
TITLE_RE = r'<title>([^<]+)</title>'
|
||||
# ...some lines of code...
|
||||
title = self._html_search_regex(TITLE_RE, webpage, 'title')
|
||||
```
|
||||
|
||||
### Collapse fallbacks
|
||||
|
Loading…
Reference in New Issue
Block a user