diff --git a/clone-moodle.py b/clone-moodle.py index 3d18a29..7b519b3 100644 --- a/clone-moodle.py +++ b/clone-moodle.py @@ -75,13 +75,12 @@ def findRessourceTab(html): tabs = html.find("ul",attrs={"class":"unlist"}).find_all("li") for tab in tabs: - if('resources' in tab.a.get('href')): linkTab = tab.a.get('href') - else : + break + else: linkTab = "none" return linkTab - def savefile(title,documentlink,cookie): reqDocument = request(documentlink,cookie) filetype = reqDocument.headers['content-type'].split('/')[-1] @@ -188,7 +187,7 @@ def main(): # Creating the class folder createFolder(title) - + # Trying to access the ressource tab ressourceLink = findRessourceTab(thisClassHTML) @@ -200,7 +199,7 @@ def main(): os.chdir("..") continue ressourceHTML = BeautifulSoup(req.text,"html.parser") - + findAllDocuments(ressourceHTML,loginCookie) os.chdir("..") os.chdir("..")