]> git.scottworley.com Git - paperdoorknob/blobdiff - paperdoorknob.py
Rename html → dom
[paperdoorknob] / paperdoorknob.py
index 1350784584dc20e3c4cee60c3bfd71321883ffe1..ade0b885d42addb973f415599798bd2e153ac961 100644 (file)
@@ -10,7 +10,7 @@ from bs4 import BeautifulSoup
 from bs4.element import Tag
 
 from args import spec_from_commandline_args
 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
 
 
 from spec import Spec
 
 
@@ -57,10 +57,11 @@ def process(spec: Spec) -> None:
     html = spec.fetcher.fetch(url)
     spec.log('Parsing HTML...\r')
     dom = parse(spec.htmlfilter(html))
     html = spec.fetcher.fetch(url)
     spec.log('Parsing HTML...\r')
     dom = parse(spec.htmlfilter(html))
+    thread = Thread(dom)
     spec.log('Counting chunks...\r')
     spec.log('Counting chunks...\r')
-    num_chunks = ilen(chunkDOMs(dom))
+    num_chunks = ilen(thread.chunkDOMs())
     title = get_title(dom) or "chunk"
     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)
         percent = 100.0 * i / num_chunks
         spec.log(f'Processing {title} {i} of {num_chunks} ({percent:.1f}%)\r')
         spec.domfilter(r)