mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 03:40:14 +00:00
add datestr generator
This commit is contained in:
parent
f1fb504874
commit
cdc617c382
@ -8,6 +8,7 @@ import re
|
||||
import string
|
||||
import subprocess
|
||||
import unicodedata
|
||||
from datetime import datetime
|
||||
from urllib.parse import parse_qs, urlparse
|
||||
|
||||
import yt_dlp
|
||||
@ -88,6 +89,16 @@ def requests_headers():
|
||||
return {"User-Agent": template}
|
||||
|
||||
|
||||
def date_praser(timestamp):
|
||||
"""return formatted date string"""
|
||||
if isinstance(timestamp, int):
|
||||
date_obj = datetime.fromtimestamp(timestamp)
|
||||
elif isinstance(timestamp, str):
|
||||
date_obj = datetime.strptime(timestamp, "%Y-%m-%d")
|
||||
|
||||
return datetime.strftime(date_obj, "%d %b, %Y")
|
||||
|
||||
|
||||
class UrlListParser:
|
||||
"""take a multi line string and detect valid youtube ids"""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user