Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions clone-moodle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -188,7 +187,7 @@ def main():

# Creating the class folder
createFolder(title)

# Trying to access the ressource tab
ressourceLink = findRessourceTab(thisClassHTML)

Expand All @@ -200,7 +199,7 @@ def main():
os.chdir("..")
continue
ressourceHTML = BeautifulSoup(req.text,"html.parser")

findAllDocuments(ressourceHTML,loginCookie)
os.chdir("..")
os.chdir("..")
Expand Down