mirror of
https://github.com/KevinMidboe/ITLscraper.git
synced 2025-10-29 01:30:14 +00:00
add single scrape
This commit is contained in:
@@ -203,6 +203,18 @@ def find_files(folders):
|
||||
#print(args.session_cookie)
|
||||
#key = args.session_cookie
|
||||
folder_url = "https://ntnu.itslearning.com/Folder/processfolder.aspx?FolderID="
|
||||
course_url = input("Emne link or leave blank to download all:")
|
||||
if course_url:
|
||||
folder_title=input("folder title:")
|
||||
r = rq.get(course_url, cookies=itl_cookies)
|
||||
course_path = os.path.join(os.path.abspath(os.path.curdir))
|
||||
make_folder(course_path, folder_title)
|
||||
folder_id = re.search("FolderID=(.+?)'",r.text).group(1)
|
||||
r = rq.get(folder_url+folder_id, cookies=itl_cookies)
|
||||
r = rq.get(folder_url+folder_id, cookies=itl_cookies)
|
||||
table = find_folder_table(r.text)
|
||||
find_files(table)
|
||||
else:
|
||||
for course in courses:
|
||||
r = rq.get(base_url+course, cookies=itl_cookies)
|
||||
course_path = os.path.join(os.path.abspath(os.path.curdir))
|
||||
|
||||
Reference in New Issue
Block a user