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 39cc121

Browse files
addeded linkedin_video downloader
1 parent 77ae12d commit 39cc121

File tree

3 files changed

+119
-0
lines changed

3 files changed

+119
-0
lines changed

‎Linkedin_Video_Downloader/Readme.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Linkedin Video Downloader
2+
3+
A GUI downloader used to download Lnkedin video by providing URL of the Post.
4+
5+
## Installation
6+
7+
> pip3 install -r requirements.txt
8+
## Usage
9+
10+
Provide the URL of the Post in the field and click `Download`.
11+
12+
## Output
13+
14+
Downloaded video you desired in the same directory of the script.
15+
16+
## Authors
17+
18+
Written by [Sukriti-sood](https://www.github.com/Sukriti-sood).
19+
20+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests==2.25.1

‎Linkedin_Video_Downloader/script.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# ALL Imports
2+
3+
import tkinter as tk
4+
import requests as req
5+
import html
6+
7+
8+
def Invalid_Url():
9+
""" Sets Status bar label to error message """
10+
Download_Window.insert(tk.END,f"Invalid URL")
11+
Status["text"] = "Invalid URL..."
12+
Status["fg"] = "red"
13+
14+
15+
def Download_vid():
16+
17+
# Validates Link and download Video
18+
Download_Window.delete("0.0", "end")
19+
global Url_Val
20+
url=Url_Val.get()
21+
22+
Status["text"]="Downloading"
23+
Status["fg"]="green"
24+
25+
26+
# Validating Input
27+
28+
if not "linkedin.com/posts" in url:
29+
Invalid_Url()
30+
return
31+
32+
response =req.get(url)
33+
34+
if not response.status_code == 200:
35+
Invalid_Url()
36+
return
37+
38+
htmlsource = response.text
39+
40+
sources = html.unescape(htmlsource).split()
41+
42+
for source in sources:
43+
44+
if "dms.licdn.com" in source:
45+
46+
videourl = source.split(',')[0].split('"src":')[1][1:-1]
47+
48+
r = req.get(videourl, stream=True)
49+
50+
total_size = int(r.headers.get('content-length', 0))
51+
52+
block_size = 1024
53+
54+
with open('video.mp4', 'wb') as file:
55+
totaldata=0;
56+
for data in r.iter_content(block_size):
57+
totaldata+=len(data)
58+
per_downloaded=totaldata*100/total_size
59+
Download_Window.delete("1.0","end")
60+
Download_Window.insert(tk.END,f"Dowloaded.... {per_downloaded}%")
61+
file.write(data)
62+
print("Download Finished")
63+
break
64+
65+
Status["text"] = "Finished!!"
66+
Status["fg"] = "green"
67+
68+
69+
# GUI
70+
71+
ld_window=tk.Tk()
72+
ld_window.title("Linkedin Video Downloader")
73+
ld_window.geometry("400x400")
74+
75+
# Label for URL Input
76+
input_label= tk.Label(ld_window,text="Enter Linkedin Video URL:")
77+
input_label.pack()
78+
79+
# Input of URL
80+
Url_Val = tk.StringVar()
81+
Url_Input = tk.Entry(ld_window, textvariable=Url_Val, font=("Calibri", 9))
82+
Url_Input.place( x=25,y=50, width=350)
83+
84+
# Button for Download
85+
Download_button = tk.Button(ld_window, text="Download", font=("Calibri", 9), command=Download_vid)
86+
Download_button.place(x=100, y=100, width=200)
87+
88+
# Download Window
89+
90+
Download_Window = tk.Text(ld_window, font=("Calibri", 9), bg="black", fg="white", bd=1, relief=tk.SUNKEN, wrap=tk.WORD)
91+
Download_Window.insert(tk.END, "Welcome to Linkedin Video Downloader, Provide a Linkedin post link in the above box and click download to start the process. :D")
92+
Download_Window.place(x=25, y=200, width=350, height=250)
93+
94+
# Text for Status of Downloading
95+
Status = tk.Label(ld_window, text="Hello!! :D", fg="blue", font=("Calibri", 9), bd=1, relief=tk.SUNKEN, anchor=tk.W, padx=3)
96+
Status.pack(side=tk.BOTTOM, fill=tk.X)
97+
98+
ld_window.mainloop()

0 commit comments

Comments
(0)

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