forked from TheAlgorithms/Python
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstagram_video.py
More file actions
Latest commit
17 lines (12 loc) · 559 Bytes
/
Copy pathinstagram_video.py
File metadata and controls
17 lines (12 loc) · 559 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fromdatetimeimportdatetime
importrequests
defdownload_video(url: str) ->bytes:
base_url="https://downloadgram.net/wp-json/wppress/video-downloader/video?url="
video_url=requests.get(base_url+url).json()[0]["urls"][0]["src"]
returnrequests.get(video_url).content
if__name__=="__main__":
url=input("Enter Video/IGTV url: ").strip()
file_name=f"{datetime.now():%Y-%m-%d_%H:%M:%S}.mp4"
withopen(file_name, "wb") asfp:
fp.write(download_video(url))
print(f"Done. Video saved to disk as {file_name}.")