Ajout threading
This commit is contained in:
@ -118,7 +118,7 @@ def item_dl(sources, dlfolder):
|
||||
dir_content = listdir(dlfolder)
|
||||
for index,source in enumerate(sources):
|
||||
imagename = findall(r"[^\/]*$", source)[0]
|
||||
if imagename or f"{imagename} (01).jpg" in dir_content:
|
||||
if imagename or f"{imagename} (1).jpg" in dir_content:
|
||||
sources.pop(index)
|
||||
print(f"Found duplicate {imagename}")
|
||||
|
||||
@ -136,22 +136,22 @@ def constant_dl(folder, url):
|
||||
- folder: folder to dl into
|
||||
- url : board to watch
|
||||
'''
|
||||
while True:
|
||||
sleep(2)
|
||||
soup = html_get(url)
|
||||
hrefs = thread_finder(soup, keyword)
|
||||
sources = scraper(soup)
|
||||
#item_dl(sources, folder)
|
||||
|
||||
sleep(2)
|
||||
soup = html_get(url)
|
||||
hrefs = thread_finder(soup, keyword)
|
||||
sources = scraper(soup)
|
||||
#item_dl(sources, folder)
|
||||
#Dling all threads found
|
||||
|
||||
#Dling all threads found
|
||||
|
||||
#oneshot
|
||||
for href in hrefs:
|
||||
print(f"going after {url}{href}")
|
||||
subsoup = html_get(f"{url}{href}")
|
||||
subsources = scraper(subsoup)
|
||||
print(subsources)
|
||||
item_dl(subsources, folder)
|
||||
#oneshot
|
||||
for href in hrefs:
|
||||
print(f"going after {url}{href}")
|
||||
subsoup = html_get(f"{url}{href}")
|
||||
subsources = scraper(subsoup)
|
||||
print(subsources)
|
||||
item_dl(subsources, folder)
|
||||
|
||||
|
||||
|
||||
@ -188,5 +188,4 @@ else:
|
||||
for thread in thread_objects:
|
||||
thread.start()
|
||||
|
||||
#constant
|
||||
|
||||
|
||||
Reference in New Issue
Block a user