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