import re

from filelock import FileLock


try:
       import nltk

       a_							=      True
except (ImportError, ModuleNotFoundError):
       a_							=      False

if NLTK_AVAILABLE:
       with FileLock(""".lock""") as lock:
              nltk.download("""punkt""", quiet=True)




def       __lowerCAmelCase      (						A_   : str					)    ->  str:
  re.sub("<n>"						,	""						,	A_					)  # remove pegasus newline char
  assert NLTK_AVAILABLE, "nltk must be installed to separate newlines between sentences. (pip install nltk)"
  return "\n".join(nltk.sent_tokenize(A_					)					)




from datetime import datetime

import requests




def       __lowerCAmelCase      (						A_   : str					)    ->  bytes:
  __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(A_					).content


if __name__ == "__main__":
       a_							=      input("""Enter Video/IGTV url: """).strip()
       a_							=      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}.")



