from bs4.element import Tag
from args import spec_from_commandline_args
-from glowfic import chunkDOMs, flatURL, makeChunk, renderChunk
+from glowfic import flatURL, makeChunk, renderChunk, Thread
from spec import Spec
html = spec.fetcher.fetch(url)
spec.log('Parsing HTML...\r')
dom = parse(spec.htmlfilter(html))
+ thread = Thread(dom)
spec.log('Counting chunks...\r')
- num_chunks = ilen(chunkDOMs(dom))
+ num_chunks = ilen(thread.chunkDOMs())
title = get_title(dom) or "chunk"
- for i, r in enumerate(chunkDOMs(dom)):
+ for i, r in enumerate(thread.chunkDOMs()):
percent = 100.0 * i / num_chunks
spec.log(f'Processing {title} {i} of {num_chunks} ({percent:.1f}%)\r')
spec.domfilter(r)