1
0
Fork 0

BasicScraper is replaced with a threaded one. Also OP's post handling altered.

master 0.2.0
Alexander Andreev 2 years ago
parent 195d4d057a
commit 22961611da
  1. 9
      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()

Loading…
Cancel
Save