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 cbb17d9

Browse files
committed
Added project files
1 parent c4e58b8 commit cbb17d9

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-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 used to download
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: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
global URL_Val
15+
url = URL_Val.get()
16+
17+
Status["text"] = "Downloading..."
18+
Status["fg"] = "green"
19+
20+
# Validate input
21+
if not "twitter.com" in url:
22+
Invalid_URL()
23+
return
24+
response = requests.get(url)
25+
if not response.status_code == 200:
26+
Invalid_URL()
27+
response.close()
28+
return
29+
response.close()
30+
31+
with subprocess.Popen("youtube-dl {} --no-cache-dir".format(url), stdout=subprocess.PIPE, shell=True, universal_newlines=True) as Process:
32+
for line in Process.stdout:
33+
Download_Window.insert(END, line)
34+
main.update_idletasks()
35+
36+
Status["text"] = "Finished!!"
37+
Status["fg"] = "green"
38+
39+
40+
# <----- GUI Code Block Start ----->
41+
main = Tk()
42+
main.title("Twitter Video Downloader")
43+
main.geometry("600x400")
44+
45+
URL_Label = Label(main, text="Enter Twitter Video URL:", anchor=W, font=("Calibri", 9))
46+
URL_Label.place(x=30, y=20)
47+
48+
URL_Val = StringVar()
49+
URL_Input = Entry(main, textvariable=URL_Val, font=("Calibri", 9))
50+
URL_Input.place(x=60, y=50, width=400)
51+
52+
Download_button = Button(main, text="Download", font=("Calibri", 9), command=Download_vid)
53+
Download_button.place(x=250, y=80, width=100)
54+
55+
Download_Window = Text(main, font=("Calibri", 9), bg="black", fg="white", bd=1, relief=SUNKEN, wrap=WORD)
56+
Download_Window.place(x=30, y=120, width=530, height=250)
57+
58+
Status = Label(main, text="Hello!! :D", fg="orange", font=("Calibri", 9), bd=1, relief=SUNKEN, anchor=W, padx=3)
59+
Status.pack(side=BOTTOM, fill=X)
60+
61+
main.mainloop()
62+
# <----- GUI Code Block End ----->

0 commit comments

Comments
(0)

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