Mercurial > codedump
view getdate.py @ 67:9636d5dee08c
[channeldownloader.py] Python 2.7 compatibility
Also make the code a *lot* more optimized
(e.g. removing the unnecessary double for-loop)
committer: GitHub <noreply@github.com>
author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
---|---|
date | Wed, 18 May 2022 18:57:58 -0400 |
parents | 1508aee998df |
children |
line wrap: on
line source
import json import sys import datetime with open(sys.argv[1]) as f: data = json.load(f) print(data['fulltitle'] + " [{0}]".format(data["uploader"]), end="\n\n-----------------\n\n") upload_date = datetime.datetime(int(data["upload_date"][:-4]), int(data["upload_date"][4:][:-2]), int(data["upload_date"][6:])) print("Published on " + f"{upload_date.strftime('%b')} {upload_date.strftime('%d').strip('0')}, {upload_date.strftime('%Y')}", end="\n\n") print(data["description"])