Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 27fa3fd

Browse files
Merge pull request avinashkranjan#1046 from XZANATOL/Twitter-vid-downloader
Twitter Video Downloader
2 parents f65dbab + a39f9f8 commit 27fa3fd

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

‎Twitter_Video_Downloader/Readme.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Twitter Video Downloader
2+
3+
A GUI downloader used to download Twitter videos by providing its link.
4+
5+
## Installation
6+
7+
> pip3 install -r requirements.txt
8+
9+
## Usage
10+
11+
Provide the Twitter video URL in the field and click `Download`.
12+
13+
## Output
14+
15+
Downloaded video you desired in the same directory of the script.
16+
17+
## Authors
18+
19+
Written by [XZANATOL](https://www.github.com/XZANATOL).
20+
21+
The project was built as a contribution during [GSSOC'21](https://gssoc.girlscript.tech/).
22+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
twitter-dl
2+
requests

‎Twitter_Video_Downloader/script.py‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
from tkinter import *
2+
import subprocess
3+
import requests
4+
5+
6+
def Invalid_URL():
7+
""" Sets Status bar label to error message """
8+
Status["text"] = "Invalid URL..."
9+
Status["fg"] = "red"
10+
11+
12+
def Download_vid():
13+
""" Validates link and Downloads Video """
14+
Download_Window.delete("0.0", "end")
15+
global URL_Val
16+
url = URL_Val.get()
17+
18+
Status["text"] = "Downloading..."
19+
Status["fg"] = "green"
20+
21+
# Validate input
22+
if not "twitter.com" in url:
23+
Invalid_URL()
24+
return
25+
response = requests.get(url)
26+
if not response.status_code == 200:
27+
Invalid_URL()
28+
response.close()
29+
return
30+
response.close()
31+
32+
with subprocess.Popen("youtube-dl {} --no-cache-dir".format(url), stdout=subprocess.PIPE, shell=True, universal_newlines=True) as Process:
33+
for line in Process.stdout:
34+
Download_Window.insert(END, line)
35+
main.update_idletasks()
36+
37+
Status["text"] = "Finished!!"
38+
Status["fg"] = "green"
39+
40+
41+
# <----- GUI Code Block Start ----->
42+
main = Tk()
43+
main.title("Twitter Video Downloader")
44+
main.geometry("600x400")
45+
46+
URL_Label = Label(main, text="Enter Twitter Video URL:", anchor=W, font=("Calibri", 9))
47+
URL_Label.place(x=30, y=20)
48+
49+
URL_Val = StringVar()
50+
URL_Input = Entry(main, textvariable=URL_Val, font=("Calibri", 9))
51+
URL_Input.place(x=60, y=50, width=400)
52+
53+
Download_button = Button(main, text="Download", font=("Calibri", 9), command=Download_vid)
54+
Download_button.place(x=250, y=80, width=100)
55+
56+
Download_Window = Text(main, font=("Calibri", 9), bg="black", fg="white", bd=1, relief=SUNKEN, wrap=WORD)
57+
Download_Window.insert(END, "Welcome to Twitter Video Downloader, Provide a Twitter video link in the above box and click download to start the process. :D")
58+
Download_Window.place(x=30, y=120, width=530, height=250)
59+
60+
Status = Label(main, text="Hello!! :D", fg="orange", font=("Calibri", 9), bd=1, relief=SUNKEN, anchor=W, padx=3)
61+
Status.pack(side=BOTTOM, fill=X)
62+
63+
main.mainloop()
64+
# <----- GUI Code Block End ----->

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /