Ajout boucle try sur les dls
This commit is contained in:
@ -10,12 +10,23 @@ from os import mkdir, listdir
|
|||||||
from re import findall
|
from re import findall
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
'''
|
'''
|
||||||
############## 4chan thread scrapper ################
|
############## 4chan thread scrapper ################
|
||||||
here we look for particular threads on 4chan and dl their images
|
This script is deisgned to look for specific words on 4 chan boards, and download all images from relevant thread.
|
||||||
|
Usage of a VPN is recommended since 4chan is a shady place. Use at your own risk !
|
||||||
|
|
||||||
|
|
||||||
|
. \\
|
||||||
|
,` ( ` SquiP
|
||||||
|
( \' "
|
||||||
|
`-.__)_
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getArgs():
|
def getArgs():
|
||||||
'''Gets all the arguments passed to the script and returns them in a parse_args()-type object.
|
'''Gets all the arguments passed to the script and returns them in a parse_args()-type object.
|
||||||
No args
|
No args
|
||||||
@ -133,23 +144,25 @@ def constant_dl(folder, url):
|
|||||||
- folder: folder to dl into
|
- folder: folder to dl into
|
||||||
- url : board to watch
|
- url : board to watch
|
||||||
'''
|
'''
|
||||||
while True:
|
try:
|
||||||
sleep(2)
|
while True:
|
||||||
soup = html_get(url)
|
sleep(2)
|
||||||
hrefs = thread_finder(soup, keyword)
|
soup = html_get(url)
|
||||||
sources = scraper(soup)
|
hrefs = thread_finder(soup, keyword)
|
||||||
#item_dl(sources, folder)
|
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)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Houston, we had a problem: \n{e}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user