1
0

style: Run linter and fix formatting issues in youtube.py

This commit is contained in:
Jon Michael Aanes (aider) 2025-03-15 22:35:07 +01:00
parent 638a3ae842
commit c3d2b98bb5

View File

@ -42,10 +42,14 @@ def scrape(watch_history: bool) -> list[dict[str, str]]:
) )
if result.returncode != 0: if result.returncode != 0:
message = 'Non-zero returncode in command: ' + str(result.returncode) + "\n\n" + result.stderr message = (
'Non-zero returncode in command: '
+ str(result.returncode)
+ '\n\n'
+ result.stderr
)
raise RuntimeError(message) raise RuntimeError(message)
output = [] output = []
for line in result.stdout.splitlines(): for line in result.stdout.splitlines():
data = json.loads(line) data = json.loads(line)
@ -55,7 +59,7 @@ def scrape(watch_history: bool) -> list[dict[str, str]]:
if data.get('timestamp'): if data.get('timestamp'):
data['watch_datetime'] = datetime.datetime.fromtimestamp( data['watch_datetime'] = datetime.datetime.fromtimestamp(
int(data['timestamp']), int(data['timestamp']),
tz=datetime.timezone.utc tz=datetime.timezone.utc,
).isoformat() ).isoformat()
else: else:
data['thumbnail'] = data['thumbnails'][-1]['url'] data['thumbnail'] = data['thumbnails'][-1]['url']