-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmusicalsave.py
77 lines (58 loc) · 2.19 KB
/
musicalsave.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import urllib.request
import re
import argparse
import sys
import os
from time import sleep
__version__ = "1.0"
banner = """
\033[1m\033[91m .d888888b.
d88888888b
8888 8888
8888 8888
8888 8888 .d888888b.
8888 8888 d88888888b
8888 8888 8888 8888
8888 8888 8888 8888
8888 8888 8888 8888
d88P 8888 8888 8888
888888888888888b. 8888 8888 "88888888888888
8888888888888P" 8888 8888 Y8888888888888
8888 8888
"888 888"
Y888888Y
\033[93mMusical.ly Downloader (\033[91mMusicalSave\033[93m)
\033[94mMade with <3 by: \033[93mSadCode Official (\033[91mSadCode\033[93m)
\033[94mVersion: \033[93m{}
\033[0m
"""
def download(url):
print("\033[1;92m [+] Visiting -->\033[93m", url)
response = urllib.request.urlopen(url)
html = response.read().decode('utf-8')
print("\033[1;92m [+] Extracting Video")
file_url = re.search('http(.*)mp4', html)
file_url = file_url[0]
file_name = file_url.split("/")[-1]
path = file_name
print("\033[1;92m [+] Downloading -->\033[93m", path)
urllib.request.urlretrieve(file_url, path)
print("\033[1;33m [!] Successfully Downloaded To -->\033[93m",
os.getcwd()+"/"+str(file_name),
"\033[0m")
def main():
parser = argparse.ArgumentParser(description = "Musical.ly Downloader")
parser.add_argument("-u", "--url",
help = "URL to the Musical.ly video.")
parser.add_argument("-v", "--version",
action='store_true',
help = "Get the current version.")
args = parser.parse_args()
if args.version:
print(__version__)
elif args.url:
print(banner.format(__version__))
download(args.url)
elif len(sys.argv) == 1:
parser.print_help()
main()