



from datetime import datetime

import requests
from bsa import BeautifulSoup

if __name__ == "__main__":
	_lowerCAmelCase	:   Optional[Any]    =   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	:   Optional[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}.""")





from bisect import bisect
from itertools import accumulate







def     UpperCAmelCase_		(					snake_case__    ,			snake_case__    ,			snake_case__    ,			snake_case__					)	->     Optional[int]:



				"""simple docstring"""





				lowerCAmelCase__		  =  sorted(zip(snake_case__    ,			snake_case__					)    ,			key=lambda snake_case__					: x[0] / x[1]    ,			reverse=snake_case__					)
				lowerCAmelCase__  ,   lowerCAmelCase__		  =  [i[0] for i in r], [i[1] for i in r]
				lowerCAmelCase__		  =  list(accumulate(snake_case__					)					)
				lowerCAmelCase__		  =  bisect(snake_case__    ,			snake_case__					)
				return (
				    0
				    if k == 0
				    else sum(vl[:k]					) + (w - acc[k - 1]) * (vl[k]) / (wt[k])
				    if k != n
				    else sum(vl[:k]					)
				)


if __name__ == "__main__":
	import doctest

	doctest.testmod()
