Update some files
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,6 @@ PornHub-dl is a Python tool for downloading PornHub video/playlist.
|
||||
```bash
|
||||
Python 3.7 or later
|
||||
VPN or any anti - Deep Packet Inspection (if your ISP blocks Pornhub) ^-^
|
||||
|
||||
```
|
||||
## Installation
|
||||
|
||||
@@ -64,3 +63,4 @@ PyFiglet (simple and beauty)
|
||||
```
|
||||
|
||||
# from tnt2402 with <3
|
||||
## modified by JDM17 with <3
|
||||
|
||||
@@ -103,7 +103,6 @@ def fix_title(s):
|
||||
|
||||
def check_output_dir(model_name):
|
||||
global download_dir
|
||||
# download_dir = download_dir
|
||||
if not os.path.exists(download_dir + model_name):
|
||||
os.mkdir(download_dir + model_name)
|
||||
|
||||
|
||||
@@ -18,12 +18,6 @@ else:
|
||||
ssl._create_default_https_context = _create_unverified_https_context
|
||||
|
||||
|
||||
def save_file(filename, list_to_file):
|
||||
with open(filename, encoding="utf-8", mode="w") as f:
|
||||
for url in list_to_file:
|
||||
f.write(url + "\n")
|
||||
|
||||
|
||||
def main():
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('--url', type=str, help='URL of Pornhub video')
|
||||
@@ -43,14 +37,14 @@ def main():
|
||||
ph_config_dl_dir(args.dir)
|
||||
if (args.url == None and args.playlist != None):
|
||||
print("URL cannot be empty!")
|
||||
sys.exit()
|
||||
sysexit()
|
||||
elif (args.playlist != None):
|
||||
ph_get_playlist(args.url, args.playlist, args.limit)
|
||||
elif (args.url != None):
|
||||
ph_get_video(args.url)
|
||||
elif (args.file != None):
|
||||
if not isfile(args.file):
|
||||
print("file not found")
|
||||
print("File not found")
|
||||
sysexit()
|
||||
with open(args.file, encoding="utf-8") as f:
|
||||
temp = list(filter(None, f.read().split("\n")))
|
||||
@@ -67,8 +61,10 @@ def main():
|
||||
print("\nProcessed: {}/{}\n".format(count, video_len))
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
save_file(args.file, new_file)
|
||||
|
||||
with open(args.file, encoding="utf-8", mode="w") as f:
|
||||
for url in new_file:
|
||||
f.write(url + "\n")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -30,7 +30,7 @@ def save_file():
|
||||
def main():
|
||||
global filename, video_list, fl_video_list
|
||||
if not isfile(filename):
|
||||
print("file not found")
|
||||
print("File not found")
|
||||
sysexit()
|
||||
try:
|
||||
with open(filename, encoding="utf-8") as f:
|
||||
@@ -38,7 +38,7 @@ def main():
|
||||
video_list = temp.copy()
|
||||
fl_video_list = temp.copy()
|
||||
except decoder.JSONDecodeError:
|
||||
print("syntax error, check file")
|
||||
print("Syntax error, check file")
|
||||
sysexit()
|
||||
ph_config_dl_dir(None)
|
||||
video_len = len(video_list)
|
||||
@@ -48,7 +48,7 @@ def main():
|
||||
ph_get_video(url)
|
||||
fl_video_list.remove(url)
|
||||
count += 1
|
||||
print("\nDownloaded: {}/{}\n".format(count, video_len))
|
||||
print("\nProcessed: {}/{}\n".format(count, video_len))
|
||||
save_file()
|
||||
|
||||
|
||||
@@ -56,6 +56,5 @@ if __name__ == "__main__":
|
||||
try:
|
||||
main()
|
||||
except KeyboardInterrupt:
|
||||
save_file()
|
||||
sysexit()
|
||||
pass
|
||||
save_file()
|
||||
|
||||
Reference in New Issue
Block a user