Skip to content

Instantly share code, notes, and snippets.

@ongspxm
Last active April 22, 2024 17:32
Show Gist options
  • Save ongspxm/d97e901e1421809d296a218aa0207ea2 to your computer and use it in GitHub Desktop.
Save ongspxm/d97e901e1421809d296a218aa0207ea2 to your computer and use it in GitHub Desktop.
download video using keepvid service
'''
Keepvid video downloader by ongspxm
This script uses keepvid to download videos from streaming sites (youtube, etc). Currently, it is set to download 480p quality videos. Edit to fit your needs.
The links are to be entered in this format:
[name of file w/o extension] [link to video]
To automate the process, you can combine all of the links into a list. Then you can run the script in the following manner:
python path/to/keepvid.py list/of/videos.txt
If you use a list, you can comment out different lines too (using #, like in python)
'''
import urllib
import urllib2
i = raw_input()
while i:
# Skipping mechanism
if i[0] == '#':
i = raw_input()
continue
name, link = i.split()
# Get link using keepvid
res = urllib2.urlopen('http://keepvid.com/?url='+link)
html = res.read()
html = html.split('480p.mp4')[0]
html = html.split('href="')[-1]
vid_link = html.split('"')[0]
print 'downloading %s.mp4'%name
urllib.urlretrieve(vid_link, name+'.mp4')
i = raw_input()
rickroll https://www.youtube.com/watch?v=dQw4w9WgXcQ
# notdownloaded https://www.youtube.com/watch?v=B6FFfEP-y4E
ppap https://www.youtube.com/watch?v=Ct6BUPvE2sM
@kynivv
Copy link

kynivv commented Apr 22, 2024

Thanks🖤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment