diff options
Diffstat (limited to 'youtube/yt_data_extract/common.py')
| -rw-r--r-- | youtube/yt_data_extract/common.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/youtube/yt_data_extract/common.py b/youtube/yt_data_extract/common.py index dce1d30..f91a467 100644 --- a/youtube/yt_data_extract/common.py +++ b/youtube/yt_data_extract/common.py @@ -212,7 +212,7 @@ def extract_date(date_text): month, day, year = parts[-3:] month = MONTH_ABBREVIATIONS.get(month[0:3]) # slicing in case they start writing out the full month name if month and (re.fullmatch(r'\d\d?', day) is not None) and (re.fullmatch(r'\d{4}', year) is not None): - return year + '-' + month + '-' + day + return f'{year}-{month}-{day}' return None def check_missing_keys(object, *key_sequences): @@ -222,7 +222,7 @@ def check_missing_keys(object, *key_sequences): for key in key_sequence: _object = _object[key] except (KeyError, IndexError, TypeError): - return 'Could not find ' + key + return f'Could not find {key}' return None @@ -467,7 +467,7 @@ def extract_item_info(item, additional_info={}): ['shortBylineText', 'runs', 0, 'navigationEndpoint', 'browseEndpoint', 'browseId'], ['ownerText', 'runs', 0, 'navigationEndpoint', 'browseEndpoint', 'browseId'] )) - info['author_url'] = ('https://www.youtube.com/channel/' + info['author_id']) if info['author_id'] else None + info['author_url'] = f'https://www.youtube.com/channel/{info["author_id"]}' if info['author_id'] else None info['description'] = extract_formatted_text(multi_deep_get( item, ['descriptionText'], ['descriptionSnippet'], |
