Skip to content

Bulk asynchronous downloader for multiple file hosts

feat: better human date parsing (#1020)

NTFSvolume04b27c19c5a7
diff --git a/cyberdrop_dl/crawlers/_kemono_base.py b/cyberdrop_dl/crawlers/_kemono_base.py
index 6c1b6e9fd..c2bbf894e 100644
--- a/cyberdrop_dl/crawlers/_kemono_base.py
+++ b/cyberdrop_dl/crawlers/_kemono_base.py
@@ -1,7 +1,6 @@
from __future__ import annotations
import asyncio
-import calendar
import functools
import itertools
import re
@@ -16,6 +15,7 @@ from cyberdrop_dl.crawlers.crawler import Crawler
from cyberdrop_dl.exceptions import NoExtensionError, ScrapeError
from cyberdrop_dl.types import AbsoluteHttpURL, AliasModel
from cyberdrop_dl.utils import css
+from cyberdrop_dl.utils.dates import to_timestamp
from cyberdrop_dl.utils.utilities import error_handling_wrapper, remove_parts
from cyberdrop_dl.utils.validators import parse_falsy_as_none
@@ -126,7 +126,7 @@ class Post(AliasModel):
def model_post_init(self, *_) -> None:
if self.published_or_added:
- self.date = calendar.timegm(self.published_or_added.timetuple())
+ self.date = to_timestamp(self.published_or_added)
@property
def all_files(self) -> Generator[File]:
diff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.py
index b3fa960b6..eec0ef758 100644
--- a/cyberdrop_dl/crawlers/crawler.py
+++ b/cyberdrop_dl/crawlers/crawler.py
@@ -1,7 +1,6 @@
from __future__ import annotations
import asyncio
-import calendar
import re
from abc import ABC, abstractmethod
from dataclasses import field
@@ -18,9 +17,10 @@ from cyberdrop_dl.constants import NEW_ISSUE_URL
from cyberdrop_dl.data_structures.url_objects import MediaItem, ScrapeItem
from cyberdrop_dl.downloader.downloader import Downloader
from cyberdrop_dl.scraper import filters
-from cyberdrop_dl.types import AbsoluteHttpURL, SupportedDomains, SupportedPaths, TimeStamp
+from cyberdrop_dl.types import AbsoluteHttpURL
from cyberdrop_dl.utils import css
from cyberdrop_dl.utils.database.tables.history_table import get_db_path
+from cyberdrop_dl.utils.dates import parse_date, to_timestamp
from cyberdrop_dl.utils.logger import log, log_debug
from cyberdrop_dl.utils.utilities import (
error_handling_wrapper,
@@ -43,7 +43,7 @@ if TYPE_CHECKING:
from cyberdrop_dl.clients.scraper_client import ScraperClient
from cyberdrop_dl.managers.manager import Manager
- from cyberdrop_dl.types import AbsoluteHttpURL
+ from cyberdrop_dl.types import AbsoluteHttpURL, SupportedDomains, SupportedPaths, TimeStamp
UNKNOWN_URL_PATH_MSG = "Unknown URL path"
@@ -483,23 +483,19 @@ class Crawler(ABC):
if not date_or_datetime:
log(f"{msg}: Unable to extract date from soup", 40)
return None
+ parsed_date = None
try:
if format:
parsed_date = datetime.strptime(date_or_datetime, format)
else:
- parsed_date = parser.parse(date_or_datetime)
+ parsed_date = parse_date(date_or_datetime)
except (ValueError, TypeError, parser.ParserError) as e:
- log(f"{msg}: {e}", 40)
+ msg = f"{msg}: {e}"
+
+ if parsed_date is None:
+ log(msg, 40)
return None
- else:
- return TimeStamp(calendar.timegm(parsed_date.timetuple()))
-
- def parse_soup_date(
- self, soup: Tag, selector: str, attribute: str, format: str | None = None, /
- ) -> TimeStamp | None:
- if date_tag := soup.select_one(selector):
- date_str: str = css.get_attr_or_none(date_tag, attribute) or ""
- return self.parse_date(date_str, format)
+ return to_timestamp(parsed_date)
@staticmethod
def register_cache_filter(
diff --git a/cyberdrop_dl/crawlers/imgbb.py b/cyberdrop_dl/crawlers/imgbb.py
index 1729a008a..a16ff649c 100644
--- a/cyberdrop_dl/crawlers/imgbb.py
+++ b/cyberdrop_dl/crawlers/imgbb.py
@@ -1,7 +1,5 @@
from __future__ import annotations
-import calendar
-import datetime
from typing import TYPE_CHECKING, ClassVar
from cyberdrop_dl.crawlers.crawler import Crawler
@@ -76,7 +74,7 @@ class ImgBBCrawler(Crawler):
link_str: str = soup.select_one(IMAGE_SELECTOR).get("src")
link = self.parse_url(link_str)
date_str: str = soup.select_one(DATE_SELECTOR).get("title")
- scrape_item.possible_datetime = self.parse_datetime(date_str)
+ scrape_item.possible_datetime = self.parse_date(date_str, "%Y-%m-%d %H:%M:%S")
filename, ext = self.get_filename_and_ext(link.name)
await self.handle_file(link, scrape_item, filename, ext)
@@ -88,12 +86,6 @@ class ImgBBCrawler(Crawler):
filename, ext = self.get_filename_and_ext(scrape_item.url.name)
await self.handle_file(scrape_item.url, scrape_item, filename, ext)
- @staticmethod
- def parse_datetime(date: str) -> int:
- """Parses a datetime string into a unix timestamp."""
- parsed_date = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
- return calendar.timegm(parsed_date.timetuple())
-
async def is_cdn(url: URL) -> bool:
"""Determines if the url is a direct link or not."""
diff --git a/cyberdrop_dl/crawlers/imgbox.py b/cyberdrop_dl/crawlers/imgbox.py
index 8e2b9eab1..38f042145 100644
--- a/cyberdrop_dl/crawlers/imgbox.py
+++ b/cyberdrop_dl/crawlers/imgbox.py
@@ -1,7 +1,5 @@
from __future__ import annotations
-import calendar
-import datetime
from typing import TYPE_CHECKING, ClassVar
from cyberdrop_dl.crawlers.crawler import Crawler
@@ -72,9 +70,3 @@ class ImgBoxCrawler(Crawler):
link = self.parse_url(link_str)
filename, ext = self.get_filename_and_ext(link.name)
await self.handle_file(link, scrape_item, filename, ext)
-
- @staticmethod
- def parse_datetime(date: str) -> int:
- """Parses a datetime string into a unix timestamp."""
- parsed_date = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
- return calendar.timegm(parsed_date.timetuple())
diff --git a/cyberdrop_dl/crawlers/mediafire.py b/cyberdrop_dl/crawlers/mediafire.py
index ae1043f42..1bbb13bb8 100644
--- a/cyberdrop_dl/crawlers/mediafire.py
+++ b/cyberdrop_dl/crawlers/mediafire.py
@@ -1,7 +1,5 @@
from __future__ import annotations
-import calendar
-import datetime
import itertools
from typing import TYPE_CHECKING, ClassVar
@@ -55,7 +53,7 @@ class MediaFireCrawler(Crawler):
raise MediaFireError(status=e.code, message=e.message) from None
for file in folder_contents["folder_content"]["files"]:
- date = self.parse_datetime(file["created"])
+ date = self.parse_date(file["created"])
link = self.parse_url(file["links"]["normal_download"])
new_scrape_item = scrape_item.create_child(link, new_title_part=title, possible_datetime=date)
self.manager.task_group.create_task(self.run(new_scrape_item))
@@ -78,14 +76,8 @@ class MediaFireCrawler(Crawler):
raise ScrapeError(410)
raise ScrapeError(422)
- scrape_item.possible_datetime = self.parse_datetime(soup.select(DATE_SELECTOR)[-1].get_text())
+ scrape_item.possible_datetime = self.parse_date(soup.select(DATE_SELECTOR)[-1].get_text(), "%Y-%m-%d %H:%M:%S")
link_str: str = link_tag.get("href")
link = self.parse_url(link_str)
filename, ext = self.get_filename_and_ext(link.name)
await self.handle_file(link, scrape_item, filename, ext)
-
- @staticmethod
- def parse_datetime(date: str) -> int:
- """Parses a datetime string into a unix timestamp."""
- parsed_date = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
- return calendar.timegm(parsed_date.timetuple())
diff --git a/cyberdrop_dl/crawlers/omegascans.py b/cyberdrop_dl/crawlers/omegascans.py
index a478105cf..646b1caa4 100644
--- a/cyberdrop_dl/crawlers/omegascans.py
+++ b/cyberdrop_dl/crawlers/omegascans.py
@@ -1,7 +1,5 @@
from __future__ import annotations
-import calendar
-import datetime
import itertools
from typing import TYPE_CHECKING, ClassVar
@@ -86,12 +84,11 @@ class OmegaScansCrawler(Crawler):
scrape_item.add_to_parent_title(chapter_title)
date_str = soup.select(DATE_SELECTOR)[-1].get_text()
- try:
- date = parse_datetime(date_str)
- except ValueError:
+ date = self.parse_date(date_str)
+ if not date:
script = soup.select_one(DATE_JS_SELECTOR)
date_str = script.get_text().split('created_at\\":\\"')[1].split(".")[0]
- date = parse_datetime(date_str)
+ date = self.parse_date(date_str)
scrape_item.possible_datetime = date
for attribute in ("src", "data-src"):
@@ -105,12 +102,3 @@ class OmegaScansCrawler(Crawler):
scrape_item.url = scrape_item.url.with_query(None)
filename, ext = self.get_filename_and_ext(scrape_item.url.name)
await self.handle_file(scrape_item.url, scrape_item, filename, ext)
-
-
-def parse_datetime(date: str) -> int:
- """Parses a datetime string into a unix timestamp."""
- try:
- parsed_date = datetime.datetime.strptime(date, "%m/%d/%Y")
- except ValueError:
- parsed_date = datetime.datetime.strptime(date, "%Y-%m-%dT%H:%M:%S")
- return calendar.timegm(parsed_date.timetuple())
diff --git a/cyberdrop_dl/crawlers/onedrive.py b/cyberdrop_dl/crawlers/onedrive.py
index 367d73dcb..026c462f1 100644
--- a/cyberdrop_dl/crawlers/onedrive.py
+++ b/cyberdrop_dl/crawlers/onedrive.py
@@ -4,7 +4,6 @@
from __future__ import annotations
-import calendar
import json
from dataclasses import dataclass
from datetime import UTC, datetime, timedelta
@@ -14,6 +13,7 @@ from typing import TYPE_CHECKING, Any, ClassVar, Self
from cyberdrop_dl.crawlers.crawler import Crawler
from cyberdrop_dl.exceptions import ScrapeError
from cyberdrop_dl.types import AbsoluteHttpURL, SupportedDomains, SupportedPaths
+from cyberdrop_dl.utils.dates import to_timestamp
from cyberdrop_dl.utils.utilities import error_handling_wrapper
if TYPE_CHECKING:
@@ -253,7 +253,7 @@ def parse_api_response(json_resp: dict, access_details: AccessDetails) -> dict[s
"url": create_api_url(new_access_details),
"web_url": AbsoluteHttpURL(web_url_str, encoded="%" in web_url_str),
"name": json_resp["name"],
- "date": parse_datetime(date_str),
+ "date": to_timestamp(datetime.fromisoformat(date_str)),
"access_details": new_access_details,
}
@@ -268,9 +268,3 @@ def create_api_url(access_details: AccessDetails) -> AbsoluteHttpURL:
if access_details.auth_key:
return api_url.update_query(authkey=access_details.auth_key)
return api_url
-
-
-def parse_datetime(date: str) -> int:
- """Parses a datetime string into a unix timestamp."""
- parsed_date = datetime.fromisoformat(date)
- return calendar.timegm(parsed_date.timetuple())
diff --git a/cyberdrop_dl/crawlers/pkmncards.py b/cyberdrop_dl/crawlers/pkmncards.py
index cc35509dc..c28fe270f 100644
--- a/cyberdrop_dl/crawlers/pkmncards.py
+++ b/cyberdrop_dl/crawlers/pkmncards.py
@@ -1,7 +1,6 @@
from __future__ import annotations
import asyncio
-import calendar
import json
from collections import defaultdict
from dataclasses import dataclass
@@ -14,6 +13,7 @@ from cyberdrop_dl.crawlers.crawler import Crawler
from cyberdrop_dl.exceptions import ScrapeError
from cyberdrop_dl.types import AbsoluteHttpURL, SupportedPaths, TimeStamp
from cyberdrop_dl.utils import css
+from cyberdrop_dl.utils.dates import to_timestamp
from cyberdrop_dl.utils.utilities import error_handling_wrapper
if TYPE_CHECKING:
@@ -227,7 +227,7 @@ def create_set(soup: Tag) -> CardSet:
release_date: int | None = None
for item in set_info["@graph"]:
if iso_date := item.get("datePublished"):
- release_date = calendar.timegm(datetime.fromisoformat(iso_date).timetuple())
+ release_date = to_timestamp(datetime.fromisoformat(iso_date))
break
set_abbr = css.select_one(soup, _SELECTORS.SET_ABBR).text
diff --git a/cyberdrop_dl/crawlers/pmvhaven.py b/cyberdrop_dl/crawlers/pmvhaven.py
index a5ec0745f..c7f6a94eb 100644
--- a/cyberdrop_dl/crawlers/pmvhaven.py
+++ b/cyberdrop_dl/crawlers/pmvhaven.py
@@ -1,8 +1,6 @@
from __future__ import annotations
-import calendar
import json
-from datetime import datetime
from typing import TYPE_CHECKING, ClassVar
from cyberdrop_dl.crawlers.crawler import Crawler
@@ -201,7 +199,7 @@ class PMVHavenCrawler(Crawler):
resolution: str = video_info.get("height") or ""
title: str = video_info.get("title") or video_info["uploadTitle"]
link_str: str = video_info["url"]
- date = parse_datetime(video_info["isoDate"])
+ date = self.parse_date(video_info["isoDate"])
scrape_item.possible_datetime = date
link = self.parse_url(link_str)
@@ -266,9 +264,3 @@ def get_video_info_from_js(soup: BeautifulSoup) -> dict:
for name, index in indices.items():
video_properties[name] = info_dict["data"][index]
return video_properties
-
-
-def parse_datetime(date: str) -> int:
- """Parses a datetime string into a unix timestamp."""
- parsed_date = datetime.fromisoformat(date.replace("Z", "+00.00"))
- return calendar.timegm(parsed_date.timetuple())
diff --git a/cyberdrop_dl/crawlers/tokyomotion.py b/cyberdrop_dl/crawlers/tokyomotion.py
index 2cac65ff1..8d75e4303 100644
--- a/cyberdrop_dl/crawlers/tokyomotion.py
+++ b/cyberdrop_dl/crawlers/tokyomotion.py
@@ -2,8 +2,6 @@ from __future__ import annotations
import contextlib
import re
-from calendar import timegm
-from datetime import datetime, timedelta
from typing import TYPE_CHECKING, ClassVar
from cyberdrop_dl.crawlers.crawler import Crawler
@@ -80,7 +78,7 @@ class TokioMotionCrawler(Crawler):
with contextlib.suppress(AttributeError):
relative_date_str = soup.select_one(self.video_date_selector).text.strip()
- scrape_item.possible_datetime = parse_relative_date(relative_date_str)
+ scrape_item.possible_datetime = self.parse_date(relative_date_str)
try:
srcSD = soup.select_one('source[title="SD"]')
@@ -222,21 +220,3 @@ class TokioMotionCrawler(Crawler):
scrape_item.add_to_parent_title(full_user_title)
if user_title not in scrape_item.parent_title:
scrape_item.add_to_parent_title(user_title)
-
-
-def parse_relative_date(relative_date: timedelta | str) -> int:
- """Parses `datetime.timedelta` or `string` in a timedelta format. Returns `now() - parsed_timedelta` as an unix timestamp."""
- if isinstance(relative_date, str):
- time_str = relative_date.casefold()
- matches: list[str] = re.findall(DATE_PATTERN, time_str)
- time_dict = {"days": 0} # Assume today
-
- for value, unit in matches:
- value = int(value)
- unit = unit.lower()
- time_dict[unit] = value
-
- relative_date = timedelta(**time_dict)
-
- date = datetime.now() - relative_date
- return timegm(date.timetuple())
diff --git a/cyberdrop_dl/crawlers/xxxbunker.py b/cyberdrop_dl/crawlers/xxxbunker.py
index bf12bf1e6..c4ea44cf3 100644
--- a/cyberdrop_dl/crawlers/xxxbunker.py
+++ b/cyberdrop_dl/crawlers/xxxbunker.py
@@ -2,8 +2,6 @@ from __future__ import annotations
import asyncio
import re
-from calendar import timegm
-from datetime import datetime, timedelta
from typing import TYPE_CHECKING, ClassVar
from aiolimiter import AsyncLimiter
@@ -73,7 +71,7 @@ class XXXBunkerCrawler(Crawler):
title = css.select_one_get_text(soup, "title").rsplit(" : XXXBunker.com", 1)[0].strip()
if date_tag := soup.select_one(DATE_SELECTOR):
- scrape_item.possible_datetime = parse_relative_date(date_tag.text.strip())
+ scrape_item.possible_datetime = self.parse_date(date_tag.get_text(strip=True))
video_soup = None
try:
@@ -180,21 +178,3 @@ class XXXBunkerCrawler(Crawler):
cookies = {"PHPSESSID": self.session_cookie}
self.update_cookies(cookies)
-
-
-def parse_relative_date(relative_date: timedelta | str) -> int:
- """Parses `datetime.timedelta` or `string` in a timedelta format. Returns `now() - parsed_timedelta` as an unix timestamp."""
- if isinstance(relative_date, str):
- time_str = relative_date.casefold()
- matches: list[str] = re.findall(DATE_PATTERN, time_str)
- time_dict = {"days": 0}
-
- for value, unit in matches:
- value = int(value)
- unit = unit.lower()
- time_dict[unit] = value
-
- relative_date = timedelta(**time_dict)
-
- date = datetime.now() - relative_date
- return timegm(date.timetuple())
diff --git a/cyberdrop_dl/crawlers/youjizz.py b/cyberdrop_dl/crawlers/youjizz.py
index 79f110f7b..a076e4ee4 100644
--- a/cyberdrop_dl/crawlers/youjizz.py
+++ b/cyberdrop_dl/crawlers/youjizz.py
@@ -2,8 +2,6 @@ from __future__ import annotations
import json
import re
-from calendar import timegm
-from datetime import datetime, timedelta
from typing import TYPE_CHECKING, ClassVar, NamedTuple
from cyberdrop_dl.crawlers.crawler import Crawler
@@ -71,7 +69,7 @@ class YouJizzCrawler(Crawler):
link = self.parse_url(link_str)
date_str: str | None = info["date"]
if date_str:
- date = parse_relative_date(date_str)
+ date = self.parse_date(date_str)
scrape_item.possible_datetime = date
filename, ext = self.get_filename_and_ext(link.name)
if ext == ".m3u8":
@@ -114,22 +112,3 @@ def get_best_quality(info_dict: dict) -> Format | None:
if default_quality:
default_link_str = default_quality.get("filename") or ""
return Format(DEFAULT_QUALITY, default_link_str)
-
-
-## TODO: move to utils. multiple crawler use the same function
-def parse_relative_date(relative_date: timedelta | str) -> int:
- """Parses `datetime.timedelta` or `string` in a timedelta format. Returns `now() - parsed_timedelta` as an unix timestamp."""
- if isinstance(relative_date, str):
- time_str = relative_date.casefold()
- matches: list[str] = re.findall(DATE_PATTERN, time_str)
- time_dict = {"days": 0} # Assume today
-
- for value, unit in matches:
- value = int(value)
- unit = unit.lower()
- time_dict[unit] = value
-
- relative_date = timedelta(**time_dict)
-
- date = datetime.now() - relative_date
- return timegm(date.timetuple())
diff --git a/cyberdrop_dl/utils/dates.py b/cyberdrop_dl/utils/dates.py
new file mode 100644
index 000000000..68e08bf67
--- /dev/null
+++ b/cyberdrop_dl/utils/dates.py
@@ -0,0 +1,151 @@
+import calendar
+import datetime
+from functools import lru_cache
+from typing import TYPE_CHECKING, Literal, TypeAlias, TypeVar
+
+import dateparser.date
+import dateutil
+import dateutil.parser
+
+if TYPE_CHECKING:
+ from cyberdrop_dl.types import TimeStamp
+else:
+ TimeStamp = int
+
+MIDNIGHT_TIME = datetime.time.min
+DATE_NOT_FOUND = dateparser.date.DateData(date_obj=None, period="day")
+DateOrder: TypeAlias = Literal["DMY", "DYM", "MDY", "MYD", "YDM", "YMD"]
+ParserKind: TypeAlias = Literal["timestamp", "relative-time", "custom-formats", "absolute-time", "no-spaces-time"]
+DEFAULT_PARSERS: list[ParserKind] = ["relative-time", "custom-formats", "absolute-time", "no-spaces-time"]
+DEFAULT_DATE_ORDER = "MDY"
+
+_S = TypeVar("_S", bound=str)
+
+
+def coerce_to_list(value: _S | set[_S] | list[_S] | tuple[_S, ...] | None) -> list[_S]:
+ if value is None:
+ return []
+ if isinstance(value, tuple | set):
+ return list(value)
+ if isinstance(value, list):
+ return value
+ return [value]
+
+
+class DateParser(dateparser.date.DateDataParser):
+ """Parses incomplete dates, but they must have at least a known year and month
+
+ Parsed dates are garantied to be in the past with time at midnight (if unknown)
+
+ It can parse date strings like:
+
+ `relative-time`:
+ >>> "Today"
+ >>> "Yesterday"
+ >>> "1 hour ago"
+ >>> "1 year, 2 months ago"
+ >>> "3 hours, 50 minutes ago
+
+ `absolute-time`:
+ >>> "Fri, 12 Dec 2014 10:55:50"
+
+ `no-spaces-time`:
+ >>> "10032022"
+
+ `timestamp`:
+ >>> "1747880678"
+
+ `custom-formats`
+ """
+
+ def __init__(
+ self, parsers: list[ParserKind] | ParserKind | None = None, date_order: DateOrder | None = None
+ ) -> None:
+ date_order = date_order or DEFAULT_DATE_ORDER
+ parsers = coerce_to_list(parsers) or DEFAULT_PARSERS
+ super().__init__(
+ settings={
+ "DATE_ORDER": date_order,
+ "PREFER_DAY_OF_MONTH": "first",
+ "PREFER_DATES_FROM": "past",
+ "REQUIRE_PARTS": ["year", "month"],
+ "RETURN_TIME_AS_PERIOD": True,
+ "PARSERS": parsers,
+ }
+ )
+
+ def parse_with_locales(
+ self, date_string: str, date_formats: list[str] | str | None = None
+ ) -> tuple[datetime.datetime, str] | tuple[None, None]:
+ date_string = dateparser.date.sanitize_date(date_string)
+ date_formats = coerce_to_list(date_formats)
+ parse = dateparser.date._DateLocaleParser.parse
+ for locale in self._get_applicable_locales(date_string):
+ date_data = parse(locale, date_string, date_formats, settings=self._settings)
+ if not date_data or not date_data.date_obj:
+ continue
+
+ return date_data.date_obj, date_data.period or ""
+ return None, None
+
+ def parse_possible_incomplete_date(
+ self, date_string: str, date_formats: list[str] | str | None = None
+ ) -> datetime.datetime | None:
+ date_formats = coerce_to_list(date_formats)
+ date_data = dateparser.date.parse_with_formats(date_string, date_formats, self._settings)
+ return date_data.date_obj
+
+ def parse_human_date(
+ self, date_string: str, date_formats: list[str] | str | None = None
+ ) -> datetime.datetime | None:
+ parsed_date, period = self.parse_with_locales(date_string, date_formats)
+ if parsed_date:
+ date_had_time = period == "time"
+ if date_had_time:
+ return parsed_date
+ return remove_time_if_not_midnight(parsed_date)
+
+
+def remove_time_if_not_midnight(date: datetime.datetime) -> datetime.datetime:
+ if date.time() != MIDNIGHT_TIME:
+ date_at_midnight = datetime.datetime.combine(date.date(), MIDNIGHT_TIME)
+ return date_at_midnight
+ return date
+
+
+def parse_date(
+ date_string: str,
+ date_formats: list[str] | str | None = None,
+ /,
+ parser_kind: ParserKind | None = None,
+ date_order: DateOrder | None = None,
+) -> datetime.datetime | None:
+ parser = get_parser(parser_kind, date_order)
+ date = parser.parse_possible_incomplete_date(date_string, date_formats)
+ return date or parser.parse_human_date(date_string, date_formats)
+
+
+def parse_concrete_date(date_string: str, date_format: str) -> datetime.datetime | None:
+ try:
+ if date_format:
+ parsed_date = datetime.datetime.strptime(date_string, date_format)
+ else:
+ parsed_date = dateutil.parser.parse(date_string)
+ except (ValueError, TypeError, dateutil.parser.ParserError):
+ pass
+ else:
+ return parsed_date
+
+
+def to_timestamp(date: datetime.datetime) -> TimeStamp:
+ return TimeStamp(calendar.timegm(date.timetuple()))
+
+
+@lru_cache(maxsize=10)
+def get_parser(parser_kind: ParserKind | None = None, date_order: DateOrder | None = None) -> DateParser:
+ return DateParser(parser_kind, date_order)
+
+
+if __name__ == "__main__":
+ print(parse_date("today at noon")) # noqa: T201
+ print(parse_date("today")) # noqa: T201
diff --git a/poetry.lock b/poetry.lock
index 5550412ef..c7986596e 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -719,6 +719,29 @@ build = ["cibuildwheel", "wheel"]
dev = ["charset_normalizer (>=3.3.2,<4.0)", "coverage (>=6.4.1,<7.0)", "cryptography (>=42.0.5,<43.0)", "httpx (==0.23.1)", "mypy (>=1.9.0,<2.0)", "pytest (>=8.1.1,<9.0)", "pytest-asyncio (>=0.23.6,<1.0)", "pytest-trio (>=0.8.0,<1.0)", "ruff (>=0.3.5,<1.0)", "trio (>=0.25.0,<1.0)", "trustme (>=1.1.0,<2.0)", "typing_extensions", "uvicorn (>=0.29.0,<1.0)", "websockets (>=12.0,<13.0)"]
test = ["charset_normalizer (>=3.3.2,<4.0)", "cryptography (>=42.0.5,<43.0)", "fastapi (==0.110.0)", "httpx (==0.23.1)", "proxy.py (>=2.4.3,<3.0)", "pytest (>=8.1.1,<9.0)", "pytest-asyncio (>=0.23.6,<1.0)", "pytest-trio (>=0.8.0,<1.0)", "python-multipart (>=0.0.9,<1.0)", "trio (>=0.25.0,<1.0)", "trustme (>=1.1.0,<2.0)", "typing_extensions", "uvicorn (>=0.29.0,<1.0)", "websockets (>=12.0,<13.0)"]
+[[package]]
+name = "dateparser"
+version = "1.2.1"
+description = "Date parsing library designed to parse dates from HTML pages"
+optional = false
+python-versions = ">=3.8"
+groups = ["main"]
+files = [
+ {file = "dateparser-1.2.1-py3-none-any.whl", hash = "sha256:bdcac262a467e6260030040748ad7c10d6bacd4f3b9cdb4cfd2251939174508c"},
+ {file = "dateparser-1.2.1.tar.gz", hash = "sha256:7e4919aeb48481dbfc01ac9683c8e20bfe95bb715a38c1e9f6af889f4f30ccc3"},
+]
+
+[package.dependencies]
+python-dateutil = ">=2.7.0"
+pytz = ">=2024.2"
+regex = ">=2015.06.24,<2019.02.19 || >2019.02.19,<2021.8.27 || >2021.8.27"
+tzlocal = ">=0.2"
+
+[package.extras]
+calendars = ["convertdate (>=2.2.1)", "hijridate"]
+fasttext = ["fasttext (>=0.9.1)", "numpy (>=1.19.3,<2)"]
+langdetect = ["langdetect (>=1.0.0)"]
+
[[package]]
name = "distlib"
version = "0.3.9"
@@ -1991,6 +2014,18 @@ files = [
[package.dependencies]
six = ">=1.5"
+[[package]]
+name = "pytz"
+version = "2025.2"
+description = "World timezone definitions, modern and historical"
+optional = false
+python-versions = "*"
+groups = ["main"]
+files = [
+ {file = "pytz-2025.2-py2.py3-none-any.whl", hash = "sha256:5ddf76296dd8c44c26eb8f4b6f35488f3ccbf6fbbd7adee0b7262d43f0ec2f00"},
+ {file = "pytz-2025.2.tar.gz", hash = "sha256:360b9e3dbb49a209c21ad61809c7fb453643e048b38924c765813546746e81c3"},
+]
+
[[package]]
name = "pywin32"
version = "310"
@@ -2081,6 +2116,110 @@ files = [
{file = "pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e"},
]
+[[package]]
+name = "regex"
+version = "2024.11.6"
+description = "Alternative regular expression module, to replace re."
+optional = false
+python-versions = ">=3.8"
+groups = ["main"]
+files = [
+ {file = "regex-2024.11.6-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ff590880083d60acc0433f9c3f713c51f7ac6ebb9adf889c79a261ecf541aa91"},
+ {file = "regex-2024.11.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:658f90550f38270639e83ce492f27d2c8d2cd63805c65a13a14d36ca126753f0"},
+ {file = "regex-2024.11.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:164d8b7b3b4bcb2068b97428060b2a53be050085ef94eca7f240e7947f1b080e"},
+ {file = "regex-2024.11.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d3660c82f209655a06b587d55e723f0b813d3a7db2e32e5e7dc64ac2a9e86fde"},
+ {file = "regex-2024.11.6-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d22326fcdef5e08c154280b71163ced384b428343ae16a5ab2b3354aed12436e"},
+ {file = "regex-2024.11.6-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f1ac758ef6aebfc8943560194e9fd0fa18bcb34d89fd8bd2af18183afd8da3a2"},
+ {file = "regex-2024.11.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:997d6a487ff00807ba810e0f8332c18b4eb8d29463cfb7c820dc4b6e7562d0cf"},
+ {file = "regex-2024.11.6-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:02a02d2bb04fec86ad61f3ea7f49c015a0681bf76abb9857f945d26159d2968c"},
+ {file = "regex-2024.11.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f02f93b92358ee3f78660e43b4b0091229260c5d5c408d17d60bf26b6c900e86"},
+ {file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:06eb1be98df10e81ebaded73fcd51989dcf534e3c753466e4b60c4697a003b67"},
+ {file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:040df6fe1a5504eb0f04f048e6d09cd7c7110fef851d7c567a6b6e09942feb7d"},
+ {file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:fdabbfc59f2c6edba2a6622c647b716e34e8e3867e0ab975412c5c2f79b82da2"},
+ {file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:8447d2d39b5abe381419319f942de20b7ecd60ce86f16a23b0698f22e1b70008"},
+ {file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:da8f5fc57d1933de22a9e23eec290a0d8a5927a5370d24bda9a6abe50683fe62"},
+ {file = "regex-2024.11.6-cp310-cp310-win32.whl", hash = "sha256:b489578720afb782f6ccf2840920f3a32e31ba28a4b162e13900c3e6bd3f930e"},
+ {file = "regex-2024.11.6-cp310-cp310-win_amd64.whl", hash = "sha256:5071b2093e793357c9d8b2929dfc13ac5f0a6c650559503bb81189d0a3814519"},
+ {file = "regex-2024.11.6-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:5478c6962ad548b54a591778e93cd7c456a7a29f8eca9c49e4f9a806dcc5d638"},
+ {file = "regex-2024.11.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2c89a8cc122b25ce6945f0423dc1352cb9593c68abd19223eebbd4e56612c5b7"},
+ {file = "regex-2024.11.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:94d87b689cdd831934fa3ce16cc15cd65748e6d689f5d2b8f4f4df2065c9fa20"},
+ {file = "regex-2024.11.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1062b39a0a2b75a9c694f7a08e7183a80c63c0d62b301418ffd9c35f55aaa114"},
+ {file = "regex-2024.11.6-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:167ed4852351d8a750da48712c3930b031f6efdaa0f22fa1933716bfcd6bf4a3"},
+ {file = "regex-2024.11.6-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2d548dafee61f06ebdb584080621f3e0c23fff312f0de1afc776e2a2ba99a74f"},
+ {file = "regex-2024.11.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2a19f302cd1ce5dd01a9099aaa19cae6173306d1302a43b627f62e21cf18ac0"},
+ {file = "regex-2024.11.6-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bec9931dfb61ddd8ef2ebc05646293812cb6b16b60cf7c9511a832b6f1854b55"},
+ {file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:9714398225f299aa85267fd222f7142fcb5c769e73d7733344efc46f2ef5cf89"},
+ {file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:202eb32e89f60fc147a41e55cb086db2a3f8cb82f9a9a88440dcfc5d37faae8d"},
+ {file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:4181b814e56078e9b00427ca358ec44333765f5ca1b45597ec7446d3a1ef6e34"},
+ {file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:068376da5a7e4da51968ce4c122a7cd31afaaec4fccc7856c92f63876e57b51d"},
+ {file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ac10f2c4184420d881a3475fb2c6f4d95d53a8d50209a2500723d831036f7c45"},
+ {file = "regex-2024.11.6-cp311-cp311-win32.whl", hash = "sha256:c36f9b6f5f8649bb251a5f3f66564438977b7ef8386a52460ae77e6070d309d9"},
+ {file = "regex-2024.11.6-cp311-cp311-win_amd64.whl", hash = "sha256:02e28184be537f0e75c1f9b2f8847dc51e08e6e171c6bde130b2687e0c33cf60"},
+ {file = "regex-2024.11.6-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:52fb28f528778f184f870b7cf8f225f5eef0a8f6e3778529bdd40c7b3920796a"},
+ {file = "regex-2024.11.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:fdd6028445d2460f33136c55eeb1f601ab06d74cb3347132e1c24250187500d9"},
+ {file = "regex-2024.11.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:805e6b60c54bf766b251e94526ebad60b7de0c70f70a4e6210ee2891acb70bf2"},
+ {file = "regex-2024.11.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b85c2530be953a890eaffde05485238f07029600e8f098cdf1848d414a8b45e4"},
+ {file = "regex-2024.11.6-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bb26437975da7dc36b7efad18aa9dd4ea569d2357ae6b783bf1118dabd9ea577"},
+ {file = "regex-2024.11.6-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:abfa5080c374a76a251ba60683242bc17eeb2c9818d0d30117b4486be10c59d3"},
+ {file = "regex-2024.11.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70b7fa6606c2881c1db9479b0eaa11ed5dfa11c8d60a474ff0e095099f39d98e"},
+ {file = "regex-2024.11.6-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0c32f75920cf99fe6b6c539c399a4a128452eaf1af27f39bce8909c9a3fd8cbe"},
+ {file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:982e6d21414e78e1f51cf595d7f321dcd14de1f2881c5dc6a6e23bbbbd68435e"},
+ {file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:a7c2155f790e2fb448faed6dd241386719802296ec588a8b9051c1f5c481bc29"},
+ {file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:149f5008d286636e48cd0b1dd65018548944e495b0265b45e1bffecce1ef7f39"},
+ {file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:e5364a4502efca094731680e80009632ad6624084aff9a23ce8c8c6820de3e51"},
+ {file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0a86e7eeca091c09e021db8eb72d54751e527fa47b8d5787caf96d9831bd02ad"},
+ {file = "regex-2024.11.6-cp312-cp312-win32.whl", hash = "sha256:32f9a4c643baad4efa81d549c2aadefaeba12249b2adc5af541759237eee1c54"},
+ {file = "regex-2024.11.6-cp312-cp312-win_amd64.whl", hash = "sha256:a93c194e2df18f7d264092dc8539b8ffb86b45b899ab976aa15d48214138e81b"},
+ {file = "regex-2024.11.6-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:a6ba92c0bcdf96cbf43a12c717eae4bc98325ca3730f6b130ffa2e3c3c723d84"},
+ {file = "regex-2024.11.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:525eab0b789891ac3be914d36893bdf972d483fe66551f79d3e27146191a37d4"},
+ {file = "regex-2024.11.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:086a27a0b4ca227941700e0b31425e7a28ef1ae8e5e05a33826e17e47fbfdba0"},
+ {file = "regex-2024.11.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bde01f35767c4a7899b7eb6e823b125a64de314a8ee9791367c9a34d56af18d0"},
+ {file = "regex-2024.11.6-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b583904576650166b3d920d2bcce13971f6f9e9a396c673187f49811b2769dc7"},
+ {file = "regex-2024.11.6-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c4de13f06a0d54fa0d5ab1b7138bfa0d883220965a29616e3ea61b35d5f5fc7"},
+ {file = "regex-2024.11.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3cde6e9f2580eb1665965ce9bf17ff4952f34f5b126beb509fee8f4e994f143c"},
+ {file = "regex-2024.11.6-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0d7f453dca13f40a02b79636a339c5b62b670141e63efd511d3f8f73fba162b3"},
+ {file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:59dfe1ed21aea057a65c6b586afd2a945de04fc7db3de0a6e3ed5397ad491b07"},
+ {file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:b97c1e0bd37c5cd7902e65f410779d39eeda155800b65fc4d04cc432efa9bc6e"},
+ {file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:f9d1e379028e0fc2ae3654bac3cbbef81bf3fd571272a42d56c24007979bafb6"},
+ {file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:13291b39131e2d002a7940fb176e120bec5145f3aeb7621be6534e46251912c4"},
+ {file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4f51f88c126370dcec4908576c5a627220da6c09d0bff31cfa89f2523843316d"},
+ {file = "regex-2024.11.6-cp313-cp313-win32.whl", hash = "sha256:63b13cfd72e9601125027202cad74995ab26921d8cd935c25f09c630436348ff"},
+ {file = "regex-2024.11.6-cp313-cp313-win_amd64.whl", hash = "sha256:2b3361af3198667e99927da8b84c1b010752fa4b1115ee30beaa332cabc3ef1a"},
+ {file = "regex-2024.11.6-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:3a51ccc315653ba012774efca4f23d1d2a8a8f278a6072e29c7147eee7da446b"},
+ {file = "regex-2024.11.6-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ad182d02e40de7459b73155deb8996bbd8e96852267879396fb274e8700190e3"},
+ {file = "regex-2024.11.6-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ba9b72e5643641b7d41fa1f6d5abda2c9a263ae835b917348fc3c928182ad467"},
+ {file = "regex-2024.11.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40291b1b89ca6ad8d3f2b82782cc33807f1406cf68c8d440861da6304d8ffbbd"},
+ {file = "regex-2024.11.6-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cdf58d0e516ee426a48f7b2c03a332a4114420716d55769ff7108c37a09951bf"},
+ {file = "regex-2024.11.6-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a36fdf2af13c2b14738f6e973aba563623cb77d753bbbd8d414d18bfaa3105dd"},
+ {file = "regex-2024.11.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d1cee317bfc014c2419a76bcc87f071405e3966da434e03e13beb45f8aced1a6"},
+ {file = "regex-2024.11.6-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:50153825ee016b91549962f970d6a4442fa106832e14c918acd1c8e479916c4f"},
+ {file = "regex-2024.11.6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:ea1bfda2f7162605f6e8178223576856b3d791109f15ea99a9f95c16a7636fb5"},
+ {file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:df951c5f4a1b1910f1a99ff42c473ff60f8225baa1cdd3539fe2819d9543e9df"},
+ {file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:072623554418a9911446278f16ecb398fb3b540147a7828c06e2011fa531e773"},
+ {file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:f654882311409afb1d780b940234208a252322c24a93b442ca714d119e68086c"},
+ {file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:89d75e7293d2b3e674db7d4d9b1bee7f8f3d1609428e293771d1a962617150cc"},
+ {file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:f65557897fc977a44ab205ea871b690adaef6b9da6afda4790a2484b04293a5f"},
+ {file = "regex-2024.11.6-cp38-cp38-win32.whl", hash = "sha256:6f44ec28b1f858c98d3036ad5d7d0bfc568bdd7a74f9c24e25f41ef1ebfd81a4"},
+ {file = "regex-2024.11.6-cp38-cp38-win_amd64.whl", hash = "sha256:bb8f74f2f10dbf13a0be8de623ba4f9491faf58c24064f32b65679b021ed0001"},
+ {file = "regex-2024.11.6-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5704e174f8ccab2026bd2f1ab6c510345ae8eac818b613d7d73e785f1310f839"},
+ {file = "regex-2024.11.6-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:220902c3c5cc6af55d4fe19ead504de80eb91f786dc102fbd74894b1551f095e"},
+ {file = "regex-2024.11.6-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:5e7e351589da0850c125f1600a4c4ba3c722efefe16b297de54300f08d734fbf"},
+ {file = "regex-2024.11.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5056b185ca113c88e18223183aa1a50e66507769c9640a6ff75859619d73957b"},
+ {file = "regex-2024.11.6-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e34b51b650b23ed3354b5a07aab37034d9f923db2a40519139af34f485f77d0"},
+ {file = "regex-2024.11.6-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5670bce7b200273eee1840ef307bfa07cda90b38ae56e9a6ebcc9f50da9c469b"},
+ {file = "regex-2024.11.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:08986dce1339bc932923e7d1232ce9881499a0e02925f7402fb7c982515419ef"},
+ {file = "regex-2024.11.6-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93c0b12d3d3bc25af4ebbf38f9ee780a487e8bf6954c115b9f015822d3bb8e48"},
+ {file = "regex-2024.11.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:764e71f22ab3b305e7f4c21f1a97e1526a25ebdd22513e251cf376760213da13"},
+ {file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:f056bf21105c2515c32372bbc057f43eb02aae2fda61052e2f7622c801f0b4e2"},
+ {file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:69ab78f848845569401469da20df3e081e6b5a11cb086de3eed1d48f5ed57c95"},
+ {file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:86fddba590aad9208e2fa8b43b4c098bb0ec74f15718bb6a704e3c63e2cef3e9"},
+ {file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:684d7a212682996d21ca12ef3c17353c021fe9de6049e19ac8481ec35574a70f"},
+ {file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:a03e02f48cd1abbd9f3b7e3586d97c8f7a9721c436f51a5245b3b9483044480b"},
+ {file = "regex-2024.11.6-cp39-cp39-win32.whl", hash = "sha256:41758407fc32d5c3c5de163888068cfee69cb4c2be844e7ac517a52770f9af57"},
+ {file = "regex-2024.11.6-cp39-cp39-win_amd64.whl", hash = "sha256:b2837718570f95dd41675328e111345f9b7095d821bac435aac173ac80b19983"},
+ {file = "regex-2024.11.6.tar.gz", hash = "sha256:7ab159b063c52a0333c884e4679f8d7a85112ee3078fe3d9004b2dd875585519"},
+]
+
[[package]]
name = "requests"
version = "2.32.3"
@@ -2375,6 +2514,37 @@ files = [
[package.dependencies]
typing-extensions = ">=4.12.0"
+[[package]]
+name = "tzdata"
+version = "2025.2"
+description = "Provider of IANA time zone data"
+optional = false
+python-versions = ">=2"
+groups = ["main"]
+markers = "platform_system == \"Windows\""
+files = [
+ {file = "tzdata-2025.2-py2.py3-none-any.whl", hash = "sha256:1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8"},
+ {file = "tzdata-2025.2.tar.gz", hash = "sha256:b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9"},
+]
+
+[[package]]
+name = "tzlocal"
+version = "5.3.1"
+description = "tzinfo object for the local timezone"
+optional = false
+python-versions = ">=3.9"
+groups = ["main"]
+files = [
+ {file = "tzlocal-5.3.1-py3-none-any.whl", hash = "sha256:eb1a66c3ef5847adf7a834f1be0800581b683b5608e74f86ecbcef8ab91bb85d"},
+ {file = "tzlocal-5.3.1.tar.gz", hash = "sha256:cceffc7edecefea1f595541dbd6e990cb1ea3d19bf01b2809f362a03dd7921fd"},
+]
+
+[package.dependencies]
+tzdata = {version = "*", markers = "platform_system == \"Windows\""}
+
+[package.extras]
+devenv = ["check-manifest", "pytest (>=4.3)", "pytest-cov", "pytest-mock (>=3.3)", "zest.releaser"]
+
[[package]]
name = "uc-micro-py"
version = "1.0.3"
@@ -2757,4 +2927,4 @@ propcache = ">=0.2.1"
[metadata]
lock-version = "2.1"
python-versions = ">=3.11,<4"
-content-hash = "61f8d175574c0313b3704ffb4a2404bbe70a32eceb35b4996bc931e6e30c29da"
+content-hash = "147963b203a8dd86e81e2729f3e24a25817208f733f55268f7519db50013e763"
diff --git a/pyproject.toml b/pyproject.toml
index 233fedecb..68c9e6fb6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -14,6 +14,7 @@ dependencies = [
"browser-cookie3 >=0.20.1",
"certifi >=2025.4.26",
"curl-cffi >=0.10.0",
+ "dateparser >=1.2.1",
"get-video-properties >=0.1.1",
"inquirerpy >=0.3.4",
"m3u8 >=6.0.0",