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
24 lines (18 loc) · 657 Bytes
/
Copy pathinstagram_video.py
File metadata and controls
24 lines (18 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "httpx",
# ]
# ///
fromdatetimeimportUTC, datetime
importhttpx
defdownload_video(url: str) ->bytes:
base_url="https://downloadgram.net/wp-json/wppress/video-downloader/video?url="
video_url=httpx.get(base_url+url, timeout=10)
returnhttpx.get(video_url, timeout=10).content
if__name__=="__main__":
url=input("Enter Video/IGTV url: ").strip()
file_name=f"{datetime.now(tz=UTC).astimezone():%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}.")