



"""simple docstring"""
import importlib.metadata
from typing import Union

from packaging.version import Version, parse

from .constants import STR_OPERATION_TO_FUNC


A:   List[Any]								=		parse(importlib.metadata.version("torch"))

def       _snake_case						(						UpperCamelCase						:		Union[str, Version]			,		UpperCamelCase						:		str			,		UpperCamelCase						:		str						):
 if operation not in STR_OPERATION_TO_FUNC.keys():
  raise ValueError(F"`operation` must be one of {list(STR_OPERATION_TO_FUNC.keys()						)}, received {operation}"						)
 UpperCAmelCase	:					Optional[Any]	=	STR_OPERATION_TO_FUNC[operation]
 if isinstance(UpperCamelCase			,		UpperCamelCase						):
  UpperCAmelCase	:					Union[str, Any]	=	parse(importlib.metadata.version(UpperCamelCase						)						)
 return operation(UpperCamelCase			,		parse(UpperCamelCase						)						)

def       _snake_case						(						UpperCamelCase						:		str			,		UpperCamelCase						:		str						):
 return compare_versions(UpperCamelCase			,		UpperCamelCase			,		UpperCamelCase						)

from datetime import datetime

import requests
from bsa import BeautifulSoup

if __name__ == "__main__":
   __lowerCamelCase			: str							   =		input('''Enter image url: ''').strip()
   print(F"""Downloading image from {url} ...""")
   __lowerCamelCase			: Any							   =		BeautifulSoup(requests.get(url).content, '''html.parser''')
   # The image URL is in the content field of the first meta tag with property og:image
   __lowerCamelCase			: List[Any]							   =		soup.find('''meta''', {'''property''': '''og:image'''})['''content''']
   __lowerCamelCase			: Tuple							   =		requests.get(image_url).content
   __lowerCamelCase			: Union[str, Any]							   =		F"""{datetime.now():%Y-%m-%d_%H:%M:%S}.jpg"""
   with open(file_name, '''wb''') as fp:
      fp.write(image_data)
   print(F"""Done. Image saved to disk as {file_name}.""")
