Skip to content

Commit 6a8499b

Browse files
Epic-R-Rcclaussdhruvmanila
authored andcommitted
Instagram Video and IGTV downloader (TheAlgorithms#3981)
* Instagram Video and IGTV downloader Download Video and IGTV from Instagram * Update * Update * Some Change * Update * Update instagram_video.py * Update instagram_video.py * Update instagram_video.py * Update instagram_video.py Co-authored-by: Christian Clauss <[email protected]> Co-authored-by: Dhruv Manilawala <[email protected]>
1 parent 737e6f7 commit 6a8499b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: web_programming/instagram_video.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from datetime import datetime
2+
3+
import requests
4+
5+
6+
def download_video(url: str) -> bytes:
7+
base_url = "https://downloadgram.net/wp-json/wppress/video-downloader/video?url="
8+
video_url = requests.get(base_url + url).json()[0]["urls"][0]["src"]
9+
return requests.get(video_url).content
10+
11+
12+
if __name__ == "__main__":
13+
url = input("Enter Video/IGTV url: ").strip()
14+
file_name = f"{datetime.now():%Y-%m-%d_%H:%M:%S}.mp4"
15+
with open(file_name, "wb") as fp:
16+
fp.write(download_video(url))
17+
print(f"Done. Video saved to disk as {file_name}.")

0 commit comments

Comments
 (0)