Skip to content

Bulk asynchronous downloader for multiple file hosts

Display disclaimer on the first run

Jacob4ff319985de0
diff --git a/cyberdrop_dl/ui/prompts/general_prompts.py b/cyberdrop_dl/ui/prompts/general_prompts.py
index a0bf68856..86cf8795b 100644
--- a/cyberdrop_dl/ui/prompts/general_prompts.py
+++ b/cyberdrop_dl/ui/prompts/general_prompts.py
@@ -5,7 +5,7 @@ import os
import pathlib
from typing import TYPE_CHECKING
-from InquirerPy import inquirer
+from InquirerPy import inquirer, get_style
from InquirerPy.base.control import Choice
from InquirerPy.separator import Separator
from InquirerPy.validator import EmptyInputValidator, PathValidator
@@ -25,24 +25,31 @@ console = Console()
def main_prompt(manager: Manager) -> int:
"""Main prompt for the program"""
+ choices = [
+ Choice(1, "Download"),
+ Choice(2, "Download (All Configs)"),
+ Choice(3, "Retry Failed Downloads"),
+ Choice(4, "Create File Hashes"),
+ Choice(5, "Sort All Configs"),
+ Choice(6, "Edit URLs"),
+ Separator(),
+ Choice(7, f"Select Config (Current: {manager.config_manager.loaded_config})"),
+ Choice(8, "Change URLs.txt file and Download Location"),
+ Choice(9, "Edit Configs"),
+ Separator(),
+ Choice(10, "Import Cyberdrop_V4 Items"),
+ Choice(11, "View Changelog"),
+ Choice(12, "Exit"),
+ ]
+
+ simp_disclaimer_shown = manager.cache_manager.get("simp_disclaimer_shown")
+ if simp_disclaimer_shown == None:
+ choices = [Choice(-1, "!! VIEW DISCLAIMER !!")]
+
action = inquirer.select(
message="What would you like to do?",
- choices=[
- Choice(1, "Download"),
- Choice(2, "Download (All Configs)"),
- Choice(3, "Retry Failed Downloads"),
- Choice(4, "Create File Hashes"),
- Choice(5, "Sort All Configs"),
- Choice(6, "Edit URLs"),
- Separator(),
- Choice(7, f"Select Config (Current: {manager.config_manager.loaded_config})"),
- Choice(8, "Change URLs.txt file and Download Location"),
- Choice(9, "Edit Configs"),
- Separator(),
- Choice(10, "Import Cyberdrop_V4 Items"),
- Choice(11, "View Changelog"),
- Choice(12, "Exit"),
- ], long_instruction="ARROW KEYS: Navigate | ENTER: Select",
+ choices=choices, long_instruction="ARROW KEYS: Navigate | ENTER: Select",
+ style=get_style({"pointer": "#ff0000 bold"}) if simp_disclaimer_shown == None else None,
vi_mode=manager.vi_mode,
).execute()
diff --git a/cyberdrop_dl/ui/ui.py b/cyberdrop_dl/ui/ui.py
index a31a7519f..dcdf713b7 100644
--- a/cyberdrop_dl/ui/ui.py
+++ b/cyberdrop_dl/ui/ui.py
@@ -2,6 +2,8 @@ from __future__ import annotations
from pathlib import Path
from pydoc import pager
+from rich import print as rprint
+from textwrap import dedent
from typing import TYPE_CHECKING
from InquirerPy import inquirer
@@ -25,6 +27,11 @@ if TYPE_CHECKING:
from cyberdrop_dl.managers.manager import Manager
+def bold(text: str) -> str:
+ """Format a string in bold by overstriking."""
+ return ''.join(ch + '\b' + ch for ch in text)
+
+
def program_ui(manager: Manager):
"""Program UI"""
while True:
@@ -34,6 +41,47 @@ def program_ui(manager: Manager):
action = main_prompt(manager)
+ if action == -1:
+ simp_disclaimer = """
+ \t\t[bold red]!! DISCLAIMER !![/bold red]
+
+
+ Due to the recent DDOS attacks on [italic]SimpCity[/italic], I have made some changes to [italic]Cyberdrop-DL[/italic].
+
+ First and foremost, we have removed support for scraping [italic]SimpCity[/italic] for the time being. I know that this will upset many of you, but hopefully, you will understand my reasoning.
+
+
+ Because of the DDOS attacks that [italic]SimpCity[/italic] has been receiving, they have been forced to implement some protective features such as using a DDOS-Guard browser check, only allowing [link=https://simpcity.su/threads/emails-august-2024.365869/]whitelisted email domains[/link] to access the website, and [link=https://simpcity.su/threads/rate-limit-429-error.397746/]new rate limits[/link].
+ [italic]Cyberdrop-DL[/italic] allows a user to scrape a model's entire thread in seconds, downloading all the files that it finds. This is great but can be problematic for a few reasons:
+ \t- We end up downloading a lot of content that we will never view.
+ \t- Such large-scale scraping with no limits puts a large strain on [italic]SimpCity[/italic]'s servers, especially when they are getting DDOSed.
+ \t- Scraping has no benefit for [italic]SimpCity[/italic] - they gain nothing from us scraping their website.
+
+ For those reasons, [italic]SimpCity[/italic] has decided that they don't want to allow automated thread scraping anymore, and have removed the [italic]Cyberdrop-DL[/italic] thread from their website.
+ I want to respect [italic]SimpCity[/italic]'s wishes, and as a result, have disabled scraping for [italic]SimpCity[/italic] links.
+
+ In order to help reduce the impact that [italic]Cyberdrop-DL[/italic] has on other websites, I have decided to enable the [italic bold]update_last_forum_post[/italic bold] setting for all users' configs.
+ You can disable it again after reading through this disclaimer, however, I would recommend against it. [italic bold]update_last_forum_post[/italic bold] actually speeds up scrapes and reduces the load on websites' servers by not re-scraping entire threads and picking up where it left off last time.
+
+ Furthermore, I have adjusted the default rate-limiting settings in an effort to reduce the impact that [italic]Cyberdrop-DL[/italic] will have on websites.
+
+ I encourage you to be conscientious about how you use [italic]Cyberdrop-DL[/italic].
+ Some tips on how to reduce the impact your use of [italic]Cyberdrop-DL[/italic] will have on a website:
+ \t- Try to avoid looping runs repeatedly.
+ \t- If you have a large URLs file, try to comb through it occasionally and get rid of items you don't want anymore, and try to run [italic]Cyberdrop-DL[/italic] less often.
+ \t- Avoid downloading content you don't want. It's good to scan through the content quickly to ensure it's not a bunch of stuff you're going to delete after downloading it.
+
+ If you do want to continue downloading from SimpCity, you can use a tampermonkey script like this one: [link=https://simpcity.su/threads/forum-post-downloader-tampermonkey-script.96714/]SimpCity Tampermonkey Forum Downloader[/link]
+ """
+
+ console.clear()
+ simp_disclaimer = dedent(simp_disclaimer)
+ rprint(simp_disclaimer)
+
+ input("Press Enter to continue...")
+ manager.cache_manager.save('simp_disclaimer_shown', True)
+ exit(0)
+
# Download
if action == 1:
break