Skip to content

Commit

Permalink
Remove unsafe feature
Browse files Browse the repository at this point in the history
It's a downloader tool and it should not be restricted. Sorry about that 馃槓
  • Loading branch information
mansuf committed Jul 30, 2022
1 parent ffe69bc commit b32dac4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 36 deletions.
1 change: 1 addition & 0 deletions mangadex_downloader/cli/__init__.py
Expand Up @@ -17,6 +17,7 @@
from ..errors import MangaDexException

_deprecated_opts = {
"unsafe": "--unsafe or -u option is deprecated and will be removed in v1.4.0"
}

def _check_deprecations(log, args):
Expand Down
21 changes: 2 additions & 19 deletions mangadex_downloader/iterator.py
Expand Up @@ -97,12 +97,10 @@ def fill_data(self):
content_ratings = [
'safe',
'suggestive',
'erotica',
'pornographic'
]

if self.unsafe:
content_ratings.append('erotica')
content_ratings.append('pornographic')

params = {
'includes[]': includes,
'title': self.title,
Expand Down Expand Up @@ -172,13 +170,6 @@ def next(self) -> Manga:
while True:
manga = self.queue.get_nowait()

if not self.unsafe and (
manga.content_rating == ContentRating.Pornographic or
manga.content_rating == ContentRating.Erotica
):
# YOU SHALL NOT PASS
continue

if not self._check_status(manga):
# Filter is used
continue
Expand Down Expand Up @@ -245,14 +236,6 @@ def next(self) -> Manga:
while True:
manga = self.queue.get_nowait()

if not self.unsafe and (
manga.content_rating == ContentRating.Pornographic or
manga.content_rating == ContentRating.Erotica
):
# No unsafe ?
# No way
continue

return manga

def fill_data(self):
Expand Down
17 changes: 0 additions & 17 deletions mangadex_downloader/main.py
Expand Up @@ -238,12 +238,6 @@ def fetch(url, language=Language.English, use_alt_details=False, unsafe=False):
log.info('Fetching manga %s' % manga_id)
manga = _fetch_manga(manga_id, lang, use_alt_details=use_alt_details)

if (
manga.content_rating == ContentRating.Pornographic or
manga.content_rating == ContentRating.Erotica
) and not unsafe:
raise NotAllowed(f"You are not allowed to see \"{manga.title}\"")

log.info("Found manga \"%s\"" % manga.title)

return manga
Expand Down Expand Up @@ -377,12 +371,6 @@ def download(
else:
manga = url

if (
manga.content_rating == ContentRating.Pornographic or
manga.content_rating == ContentRating.Erotica
) and not unsafe:
raise NotAllowed(f"You are not allowed to see \"{manga.title}\"")

# base path
base_path = Path('.')

Expand Down Expand Up @@ -550,11 +538,6 @@ def download_chapter(

# Fetch manga
chap, manga = _get_manga_from_chapter(chap_id)
if (
manga.content_rating == ContentRating.Pornographic or
manga.content_rating == ContentRating.Erotica
) and not unsafe:
raise NotAllowed(f"You are not allowed to see \"{manga.title}\"")

log.info("Found chapter %s from manga \"%s\"" % (chap.chapter, manga.title))

Expand Down

0 comments on commit b32dac4

Please sign in to comment.