


import os
import string
import sys


__UpperCamelCase     :    Dict 	=				1 << 8

__UpperCamelCase     :    int 	=				{
    'tab': ord('\t'),
    'newline': ord('\r'),
    'esc': 27,
    'up': 65 + ARROW_KEY_FLAG,
    'down': 66 + ARROW_KEY_FLAG,
    'right': 67 + ARROW_KEY_FLAG,
    'left': 68 + ARROW_KEY_FLAG,
    'mod_int': 91,
    'undefined': sys.maxsize,
    'interrupt': 3,
    'insert': 50,
    'delete': 51,
    'pg_up': 53,
    'pg_down': 54,
}

__UpperCamelCase     :    Dict 	=				KEYMAP['up']
__UpperCamelCase     :    Optional[Any] 	=				KEYMAP['left']

if sys.platform == "win32":
    __UpperCamelCase     :    List[Any] 	=				[]
    __UpperCamelCase     :    List[str] 	=				{
        b'\xe0H': KEYMAP['up'] - ARROW_KEY_FLAG,
        b'\x00H': KEYMAP['up'] - ARROW_KEY_FLAG,
        b'\xe0P': KEYMAP['down'] - ARROW_KEY_FLAG,
        b'\x00P': KEYMAP['down'] - ARROW_KEY_FLAG,
        b'\xe0M': KEYMAP['right'] - ARROW_KEY_FLAG,
        b'\x00M': KEYMAP['right'] - ARROW_KEY_FLAG,
        b'\xe0K': KEYMAP['left'] - ARROW_KEY_FLAG,
        b'\x00K': KEYMAP['left'] - ARROW_KEY_FLAG,
    }

for i in range(10):
    __UpperCamelCase     :    Optional[int] 	=				ord(str(i))





def 	_UpperCAmelCase							(  ):
      """simple docstring"""




      if os.name == "nt":
            import msvcrt

            __lowerCamelCase  :   Any							    =    """mbcs"""
            # Flush the keyboard buffer
            while msvcrt.kbhit():
                  msvcrt.getch()
            if len(UpperCamelCase_   ) == 0:
                  # Read the keystroke
                  __lowerCamelCase  :   int							    =    msvcrt.getch()

                  # If it is a prefix char, get second part
                  if ch in (b"\x00", b"\xe0"):
                        __lowerCamelCase  :   int							    =    ch + msvcrt.getch()
                        # Translate actual Win chars to bullet char types
                        try:
                              __lowerCamelCase  :   List[str]							    =    chr(WIN_KEYMAP[cha]   )
                              WIN_CH_BUFFER.append(chr(KEYMAP["""mod_int"""]   )   )
                              WIN_CH_BUFFER.append(UpperCamelCase_   )
                              if ord(UpperCamelCase_   ) in (
                                  KEYMAP["insert"] - 1 << 9,
                                  KEYMAP["delete"] - 1 << 9,
                                  KEYMAP["pg_up"] - 1 << 9,
                                  KEYMAP["pg_down"] - 1 << 9,
                              ):
                                    WIN_CH_BUFFER.append(chr(126   )   )
                              __lowerCamelCase  :   Any							    =    chr(KEYMAP["""esc"""]   )
                        except KeyError:
                              __lowerCamelCase  :   Union[str, Any]							    =    cha[1]
                  else:
                        __lowerCamelCase  :   Dict							    =    ch.decode(UpperCamelCase_   )
            else:
                  __lowerCamelCase  :   Dict							    =    WIN_CH_BUFFER.pop(0   )
      elif os.name == "posix":
            import termios
            import tty

            __lowerCamelCase  :   str							    =    sys.stdin.fileno()
            __lowerCamelCase  :   Any							    =    termios.tcgetattr(UpperCamelCase_   )
            try:
                  tty.setraw(UpperCamelCase_   )
                  __lowerCamelCase  :   List[str]							    =    sys.stdin.read(1   )
            finally:
                  termios.tcsetattr(UpperCamelCase_    ,						termios.TCSADRAIN    ,						UpperCamelCase_   )
      return ch





def 	_UpperCAmelCase							(  ):
      """simple docstring"""




      __lowerCamelCase  :   Union[str, Any]							    =    get_raw_chars()
      if ord(UpperCamelCase_   ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
            return char

      elif ord(UpperCamelCase_   ) == KEYMAP["esc"]:
            __lowerCamelCase  :   Optional[Any]							    =    get_raw_chars()
            if ord(UpperCamelCase_   ) == KEYMAP["mod_int"]:
                  __lowerCamelCase  :   int							    =    get_raw_chars()
                  if ord(UpperCamelCase_   ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(UpperCamelCase_   ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
                        return chr(ord(UpperCamelCase_   ) + ARROW_KEY_FLAG   )
                  else:
                        return KEYMAP["undefined"]
            else:
                  return get_raw_chars()

      else:
            if char in string.printable:
                  return char
            else:
                  return KEYMAP["undefined"]




from datetime import datetime

import requests
from bsa import BeautifulSoup

if __name__ == "__main__":
     _SCREAMING_SNAKE_CASE 		=      input("""Enter image url: """).strip()
     print(F'''Downloading image from {url} ...''')
     _SCREAMING_SNAKE_CASE 		=      BeautifulSoup(requests.get(url).content, """html.parser""")
     # The image URL is in the content field of the first meta tag with property og:image
     _SCREAMING_SNAKE_CASE 		=      soup.find("""meta""", {"""property""": """og:image"""})["""content"""]
     _SCREAMING_SNAKE_CASE 		=      requests.get(image_url).content
     _SCREAMING_SNAKE_CASE 		=      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}.''')
