Skip to content

Commit cb7fccb

Browse files
fixes and improvements
feat: oneTimeDownload for E621 and E926 #1 feat: selection for desired site feat: new pretty logo feat: auto updater fix: spelling mistakes docs: ReadMe updated and cleaned refactor: config manager refactor: __init__.py
1 parent a4ec09d commit cb7fccb

File tree

13 files changed

+249
-118
lines changed

13 files changed

+249
-118
lines changed

.gitignore

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
21
config.json
3-
4-
modules/__pycache__/
5-
2+
__pycache__/
63
*.spec
7-
84
dist/
9-
105
build/
11-
126
media/
13-
147
.nn-d/
8+
.env/
9+
testing_accounts.txt
10+
config.json.bak
11+
old_config.json
12+
testing_accounts.txt.bak
13+
db/
14+
outdated
15+
modules/updateManager.old
16+
modules/auto_update.py
17+
runtime.log
18+
delete-exe.bat

Build Release.bat

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
pyinstaller --onefile --icon "icon.ico" --console --name "NN-Downloader" --upx-dir "Z:\Projects\Python\### UPX ###" --add-data="Z:/Projects/Python/NN-Downloader/.nn-d/Lib/site-packages/grapheme/data/*;grapheme/data/" main.py
1+
".\.env\Scripts\activate" && pyinstaller --onefile --icon "icon.ico" --console --name "NN-Downloader" --upx-dir "Z:\Projects\Python\### UPX ###" --add-data="Z:/Projects/Python/NN-Downloader/.env/Lib/site-packages/grapheme/data/*;grapheme/data/" main.py
2+
3+
rmdir /s /q .\build
4+
rmdir /s /q .\__pycache__
5+
del ".\NN-Downloader.spec"

Clean Folder.bat

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# NN-Downloader
22

3-
Welcome to the successor of the [multporn image downloader][1] [v1][2] & [v2][1] and most downloaders out there regarding "NSFW" material. The NN-Downloader or Naughty-Naughty-Downloader (yes very creative i know) supports multiple sites with their official api (if available), proxies and its also portable.
3+
Welcome to the successor of the [multporn image downloader v1][2] & [v2][1] and most downloaders out there regarding "NSFW" material. The NN-Downloader or Naughty-Naughty-Downloader (yes very creative I know) supports multiple sites with their official API (if available), and proxies and it's also portable.
44

5-
This is not the complete version and it only works on a [few][13] sites currently. The other parts are WIP and will be complete in the near future. More Documentation and other gibberish coming soo.
5+
This project is unfinished and only works on the [listed][13] sites currently. More Documentation and other gibberish are planned.
66

7-
[Download][14]
7+
[Windows Download][14] | [Linux Download][21]
88

99
<br />
1010

@@ -13,19 +13,18 @@ This is not the complete version and it only works on a [few][13] sites currentl
1313
- [E621][4] (API)
1414
- [E926][5] (API)
1515
- [Furbooru][6] (API)
16-
- [Multporn][7]
16+
- [Multporn][7]
1717
- [Yiffer][8]
18-
- [Luscious][16]
18+
- [Luscious][16] ***(Currently Broken!)***
1919

2020
#### Planned:
2121
- [YiffGallery][9]
22-
- ~~[FurryBooru][10]~~ Currently not possible due to cloudflare issues.
22+
- ~~[FurryBooru][10]~~ Is currently not possible due to Cloudflare blocking access when contacting their API.
2323
- [BooruPlus][11]
2424
- [nHentai][15]
2525
- [Pixiv][17]
2626
- [HentaiRead][18]
2727

28-
2928
[1]:https://github.com/Official-Husko/multporn-image-downloader-v2
3029
[2]:https://github.com/Official-Husko/multporn-image-downloader
3130
[3]:https://rule34.xxx
@@ -44,14 +43,20 @@ This is not the complete version and it only works on a [few][13] sites currentl
4443
[16]:https://luscious.net/
4544
[17]:https://www.pixiv.net/
4645
[18]:https://hentairead.com/
46+
[19]:https://rule34.art/
47+
[20]:https://2.multporn.net/
48+
[21]:https://github.com/HttpAnimation/NN-Downloader-Linux
4749

48-
49-
Further sites can be added. Just open a [support ticket][11] with the url to the site.
50+
Further sites can be added. Just open a [support ticket][11] with the URL to the site.
5051

5152
<br />
5253
<br />
5354
<br />
5455

5556
#### Disclaimer
56-
***I'am not in any way affiliated or working with these Sites. This is a unofficial project.***
57-
*I would suggest you to use a customized Windows Terminal.
57+
***I am not in any way affiliated or working with these Sites. This is an unofficial project.***
58+
*I would suggest you use a customized Terminal.
59+
60+
61+
[//]: # (Ingore These Lines Below)
62+
[//]: # (Including mirror [rule34.art][19] & [2.multporn.net][20])

enable_env.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
".\.env\Scripts\activate"

main.py

Lines changed: 97 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,157 +1,158 @@
1-
from modules import E621, RULE34, ProxyScraper, FURBOORU, E926, Multporn, Yiffer, Luscious
1+
from modules import *
22
import json
33
import os
44
from termcolor import colored
55
from ctypes import windll
66
from time import sleep
77
from sys import exit
8+
import inquirer
89

9-
10-
version = "1.3.1"
10+
version = "1.4.0"
1111
windll.kernel32.SetConsoleTitleW(f"NN-Downloader | v{version}")
1212
proxy_list = []
1313
header = {"User-Agent":f"nn-downloader/{version} (by Official Husko on GitHub)"}
14+
needed_folders = ["db", "media"]
15+
database_list = ["e621.db"]
16+
17+
if os.path.exists("outdated"):
18+
version_for_logo = colored(f"v{version}", "cyan", attrs=["blink"])
19+
else:
20+
version_for_logo = colored(f"v{version}", "cyan")
21+
22+
logo = f"""{colored(f'''
23+
d8b db d8b db d8888b. .d88b. db d8b db d8b db db .d88b. .d8b. d8888b. d88888b d8888b.
24+
888o 88 888o 88 88 `8D .8P Y8. 88 I8I 88 888o 88 88 .8P Y8. d8' `8b 88 `8D 88' 88 `8D
25+
88V8o 88 88V8o 88 88 88 88 88 88 I8I 88 88V8o 88 88 88 88 88ooo88 88 88 88ooooo 88oobY'
26+
88 V8o88 88 V8o88 C8888D 88 88 88 88 Y8 I8I 88 88 V8o88 88 88 88 88~~~88 88 88 88~~~~~ 88`8b
27+
88 V888 88 V888 88 .8D `8b d8' `8b d8'8b d8' 88 V888 88booo. `8b d8' 88 88 88 .8D 88. 88 `88.
28+
VP V8P VP V8P Y8888D' `Y88P' `8b8' `8d8' VP V8P Y88888P `Y88P' YP YP Y8888D' Y88888P 88 YD
29+
{version_for_logo} | by {colored("Official-Husko", "yellow")}''', "red")}
30+
"""
1431

1532
class Main():
1633
def main_startup():
1734
os.system("cls")
18-
print(colored("======================================================================================================================", "red"))
19-
print(colored("| |", "red"))
20-
print(colored("| " + colored("Product: ", "white") + colored("NN-Downloader", "green") + colored(" |", "red"), "red"))
21-
print(colored("| " + colored("Version: ", "white") + colored(version, "green") + colored(" |", "red"), "red"))
22-
print(colored("| " + colored("Description: ", "white") + colored("Download Naughty images fast from multiple sites.", "green") + colored(" |", "red"), "red"))
23-
print(colored("| |", "red"))
24-
print(colored("======================================================================================================================", "red"))
35+
print(logo)
2536
print("")
2637

27-
# Check if media folder exists else create it
28-
if not os.path.exists("media"):
29-
os.mkdir("media")
38+
# Check if needed folders exists else create them
39+
for folder in needed_folders:
40+
if not os.path.exists(folder):
41+
os.mkdir(folder)
3042

31-
# Check if config exists and read it
32-
if os.path.exists("config.json"):
33-
with open("config.json") as cf:
34-
config = json.load(cf)
35-
user_proxies = config["proxies"]
36-
user_OTD = config["oneTimeDownload"]
37-
user_blacklist = config["blacklisted_tags"]
38-
user_blocked_formats = config["blacklisted_formats"]
3943

40-
# Create a new config with default values
44+
if os.path.exists("config.json"):
45+
config = Config_Manager.reader()
46+
oneTimeDownload = config["oneTimeDownload"]
47+
use_proxies = config["proxies"]
48+
checkForUpdates = config["checkForUpdates"]
4149
else:
42-
default_config = {
43-
"proxies": "true",
44-
"oneTimeDownload": "true",
45-
"user_credentials": {
46-
"e621": {
47-
"apiUser": "",
48-
"apiKey": ""
49-
},
50-
"e926": {
51-
"apiUser": "",
52-
"apiKey": ""
53-
},
54-
"rule34": {
55-
"user_id": "",
56-
"pass_hash": "",
57-
"comment": "currently not used"
58-
},
59-
"yiffer": {
60-
"username": "",
61-
"email": "",
62-
"id": "",
63-
"comment": "currently not used"
64-
},
65-
"yiffgallery": {
66-
"pwg_id": "",
67-
"comment": "currently not used"
68-
},
69-
"furbooru": {
70-
"apiKey": ""
71-
}
72-
},
73-
"blacklisted_tags": [
74-
"example1",
75-
"example2"
76-
],
77-
"blacklisted_formats": [
78-
"example1",
79-
"example2"
80-
]
81-
}
82-
with open("config.json", "w") as cc:
83-
json.dump(default_config, cc, indent=6)
84-
cc.close()
50+
config = Config_Manager.creator()
8551
print(colored("New Config file generated. Please configure it for your use case and add API keys for needed services.", "green"))
8652
sleep(7)
8753
exit(0)
8854

89-
if user_proxies == True:
55+
if checkForUpdates == True:
56+
os.system("cls")
57+
print(logo)
58+
print("")
59+
print(colored("Checking for Updates...", "yellow"), end='\r')
60+
AutoUpdate.Checker()
61+
os.system("cls")
62+
print(logo)
63+
print("")
64+
65+
if use_proxies == True:
9066
print(colored("Fetching Fresh Proxies...", "yellow"), end='\r')
9167
ProxyScraper.Scraper(proxy_list=proxy_list)
9268
print(colored(f"Fetched {len(proxy_list)} Proxies. ", "green"))
9369
print("")
9470

71+
if oneTimeDownload == True:
72+
for database in database_list:
73+
with open(f"db/{database}", "a") as db_creator:
74+
db_creator.close()
75+
9576
print(colored("What site do you want to download from?", "green"))
96-
site = input(">> ").lower()
97-
if site == "":
98-
print(colored("Please enter a site.", "red"))
99-
sleep(3)
100-
Main.main_startup()
77+
questions = [
78+
inquirer.List('selection',
79+
choices=['E621', 'E926', 'Furbooru', 'Luscious', 'Multporn', 'Rule34', 'Yiffer']),
80+
]
81+
answers = inquirer.prompt(questions)
10182
print("")
10283

84+
site = answers.get("selection").lower()
85+
10386
if site in ["multporn", "yiffer", "luscious"]:
10487
pass
10588
else:
10689
print(colored("Please enter the tags you want to use", "green"))
10790
user_tags = input(">> ").lower()
108-
if user_tags == "":
91+
while user_tags == "":
10992
print(colored("Please enter the tags you want.", "red"))
11093
sleep(3)
111-
Main.main_startup()
94+
user_tags = input(">> ").lower()
11295
print("")
11396

114-
print(colored("How many pages would you like to get?", "green"), " (leave empty for max)")
97+
print(colored("How many pages would you like to get?", "green"), colored(" (leave empty for max)", "yellow"))
11598
max_sites = input(">> ").lower()
11699
print("")
117100

118101
if site == "e621":
119102
apiUser = config["user_credentials"]["e621"]["apiUser"]
120103
apiKey = config["user_credentials"]["e621"]["apiKey"]
104+
if oneTimeDownload == True:
105+
with open("db/e621.db", "r") as db_reader:
106+
database = db_reader.read().splitlines()
121107
if apiKey == "" or apiUser == "":
122108
print(colored("Please add your Api Key into the config.json", "red"))
123-
sleep(3)
109+
sleep(5)
124110
else:
125-
E621.Fetcher(user_tags=user_tags, user_blacklist=user_blacklist, proxy_list=proxy_list, max_sites=max_sites, user_proxies=user_proxies, apiUser=apiUser, apiKey=apiKey, header=header)
111+
E621.Fetcher(user_tags=user_tags, user_blacklist=config["blacklisted_tags"], proxy_list=proxy_list, max_sites=max_sites, user_proxies=config["proxies"], apiUser=apiUser, apiKey=apiKey, header=header, db=database)
126112
elif site == "e926":
127113
apiUser = config["user_credentials"]["e926"]["apiUser"]
128114
apiKey = config["user_credentials"]["e926"]["apiKey"]
115+
if oneTimeDownload == True:
116+
with open("db/e621.db", "r") as db_reader:
117+
database = db_reader.read().splitlines()
129118
if apiKey == "" or apiUser == "":
130119
print(colored("Please add your Api Key into the config.json", "red"))
131-
sleep(3)
120+
sleep(5)
132121
else:
133-
E926.Fetcher(user_tags=user_tags, user_blacklist=user_blacklist, proxy_list=proxy_list, max_sites=max_sites, user_proxies=user_proxies, apiUser=apiUser, apiKey=apiKey, header=header)
122+
E926.Fetcher(user_tags=user_tags, user_blacklist=config["blacklisted_tags"], proxy_list=proxy_list, max_sites=max_sites, user_proxies=config["proxies"], apiUser=apiUser, apiKey=apiKey, header=header, db=database)
134123
elif site == "rule34":
135-
RULE34.Fetcher(user_tags=user_tags, user_blacklist=user_blacklist, proxy_list=proxy_list, max_sites=max_sites, user_proxies=user_proxies, header=header)
124+
RULE34.Fetcher(user_tags=user_tags, user_blacklist=config["blacklisted_tags"], proxy_list=proxy_list, max_sites=max_sites, user_proxies=config["proxies"], header=header)
136125
elif site == "furbooru":
137126
apiKey = config["user_credentials"]["furbooru"]["apiKey"]
138127
if apiKey == "":
139128
print(colored("Please add your Api Key into the config.json", "red"))
140-
sleep(3)
129+
sleep(5)
141130
else:
142-
FURBOORU.Fetcher(user_tags=user_tags, user_blacklist=user_blacklist, proxy_list=proxy_list, max_sites=max_sites, user_proxies=user_proxies, apiKey=apiKey, header=header)
131+
FURBOORU.Fetcher(user_tags=user_tags, user_blacklist=config["blacklisted_tags"], proxy_list=proxy_list, max_sites=max_sites, user_proxies=config["proxies"], apiKey=apiKey, header=header)
143132
elif site == "multporn":
144133
print(colored("Please enter the link. (e.g. https://multporn.net/comics/double_trouble_18)", "green"))
145134
URL = input(">> ")
146-
Multporn.Fetcher(proxy_list=proxy_list, user_proxies=user_proxies, header=header, URL=URL)
135+
while URL == "":
136+
print(colored("Please enter a valid link.", "red"))
137+
sleep(1.5)
138+
URL = input(">> ")
139+
Multporn.Fetcher(proxy_list=proxy_list, user_proxies=config["proxies"], header=header, URL=URL)
147140
elif site == "yiffer":
148141
print(colored("Please enter the link. (e.g. https://yiffer.xyz/Howl & Jasper)", "green"))
149142
URL = input(">> ")
150-
Yiffer.Fetcher(proxy_list=proxy_list, user_proxies=user_proxies, header=header, URL=URL)
143+
while URL == "":
144+
print(colored("Please enter a valid link.", "red"))
145+
sleep(1.5)
146+
URL = input(">> ")
147+
Yiffer.Fetcher(proxy_list=proxy_list, user_proxies=config["proxies"], header=header, URL=URL)
151148
elif site == "luscious":
152149
print(colored("Please enter the link. (e.g. https://www.luscious.net/albums/bifurcation-ongoing_437722)", "green"))
153150
URL = input(">> ")
154-
Luscious.Fetcher(proxy_list=proxy_list, user_proxies=user_proxies, header=header, URL=URL)
151+
while URL == "":
152+
print(colored("Please enter a valid link.", "red"))
153+
sleep(1.5)
154+
URL = input(">> ")
155+
Luscious.Fetcher(proxy_list=proxy_list, user_proxies=config["proxies"], header=header, URL=URL)
155156

156157

157158
else:
@@ -161,4 +162,15 @@ def main_startup():
161162
Main.main_startup()
162163

163164
if __name__ == '__main__':
164-
Main.main_startup()
165+
try:
166+
Main.main_startup()
167+
except KeyboardInterrupt:
168+
print("User Cancelled")
169+
sleep(3)
170+
exit(0)
171+
172+
173+
"""
174+
TODO: fix luscious being broken
175+
176+
"""

modules/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
from .proxyScraper import ProxyScraper
2+
from .configManager import Config_Manager
3+
from .auto_update import AutoUpdate
4+
from .logger import Logger
5+
from .pretty_print import *
6+
7+
8+
# Here are all modules for the sites that are supported
19
from .e621 import E621
10+
from .e926 import E926
211
from .rule34 import RULE34
3-
from .proxyscraper import ProxyScraper
412
from .furbooru import FURBOORU
5-
from .e926 import E926
613
from .multporn import Multporn
714
from .yiffer import Yiffer
815
from .luscious import Luscious

0 commit comments

Comments
 (0)