"""simple docstring"""


from datetime import datetime

import requests






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      """https://downloadgram.net/wp-json/wppress/video-downloader/video?url="""
  _UpperCAmelCase						 =      requests.get(base_url + url		).json()[0]["""urls"""][0]["""src"""]
  return requests.get(lowercase		).content


if __name__ == "__main__":
    UpperCAmelCase__  		=						input("""Enter Video/IGTV url: """).strip()
    UpperCAmelCase__  		=						F'''{datetime.now():%Y-%m-%d_%H:%M:%S}.mp4'''
    with open(file_name, """wb""") as fp:
        fp.write(download_video(url))
    print(F'''Done. Video saved to disk as {file_name}.''')

"""simple docstring"""


from __future__ import annotations

from random import choice






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  return choice(lowercase		)






def     __UpperCAmelCase					(			lowercase   ,lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      random_pivot(lowercase		)

  # partition based on pivot
  # linear time
  _UpperCAmelCase						 =      [e for e in lst if e < pivot]
  _UpperCAmelCase						 =      [e for e in lst if e > pivot]

  # if we get lucky, pivot might be the element we want.
  # we can easily see this:
  # small (elements smaller than k)
  # + pivot (kth element)
  # + big (elements larger than k)
  if len(lowercase		) == k - 1:
    return pivot
  # pivot is in elements bigger than k
  elif len(lowercase		) < k - 1:
    return kth_number(lowercase   ,k - len(lowercase		) - 1		)
  # pivot is in elements smaller than k
  else:
    return kth_number(lowercase   ,lowercase		)


if __name__ == "__main__":
    import doctest

    doctest.testmod()
