From 22961611dacd62c566bbfd4d0d37c740593a361f Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 18 Jul 2020 04:44:37 +0400 Subject: [PATCH] BasicScraper is replaced with a threaded one. Also OP's post handling altered. --- scrapthechan/cli/scraper.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scrapthechan/cli/scraper.py b/scrapthechan/cli/scraper.py index c52f900..3b84ab0 100644 --- a/scrapthechan/cli/scraper.py +++ b/scrapthechan/cli/scraper.py @@ -9,7 +9,8 @@ from scrapthechan import VERSION from scrapthechan.parser import Parser, ParserThreadNotFoundError from scrapthechan.parsers import get_parser_by_url, get_parser_by_site, \ SUPPORTED_IMAGEBOARDS -from scrapthechan.scrapers.basicscraper import BasicScraper +#from scrapthechan.scrapers.basicscraper import BasicScraper +from scrapthechan.scrapers.threadedscraper import ThreadedScraper __all__ = ["main"] @@ -105,7 +106,9 @@ def main() -> None: if not args["no-op"]: print("Writing OP... ", end='') - if not exists(join(save_dir, "!op.txt")): + if parser.op is None: + print("No text's there.") + elif not exists(join(save_dir, "!op.txt")): with open(join(save_dir, "!op.txt"), 'w') as opf: opf.write(f"{parser.op}\n") print("Done.") @@ -113,7 +116,7 @@ def main() -> None: print("Exists.") - scraper = BasicScraper(save_dir, parser.files, \ + scraper = ThreadedScraper(save_dir, parser.files, \ lambda i: print(f"{i}/{flen}", end="\r")) scraper.run()