mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-08 23:45:38 +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:
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user