├── .gitignore ├── info.txt ├── requirements.txt ├── wiki ├── icon.ico ├── ex_info_txt.png ├── run_vc_kntu.png └── done_vc_kntu.png ├── export_only.py ├── exporter.py ├── iut_vc_dl.py ├── kntu_vc_dl.py ├── ikiu_vc_dl.py ├── ut_vc_dl.py ├── GUI.py ├── README.md ├── media_converter.py └── downloader.py /.gitignore: -------------------------------------------------------------------------------- 1 | output/ 2 | temp/ 3 | __pycache__/ 4 | .idea/ 5 | GUI -------------------------------------------------------------------------------- /info.txt: -------------------------------------------------------------------------------- 1 | username 2 | password 3 | url-1 4 | url-2 5 | url-3 6 | ... 7 | url-n -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | bs4 3 | html5lib 4 | ffmpeg-python 5 | xmltodict 6 | tqdm 7 | PySimpleGUI -------------------------------------------------------------------------------- /wiki/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sina-rostami/Adobe-Connect-Meetings-Downloader/HEAD/wiki/icon.ico -------------------------------------------------------------------------------- /wiki/ex_info_txt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sina-rostami/Adobe-Connect-Meetings-Downloader/HEAD/wiki/ex_info_txt.png -------------------------------------------------------------------------------- /wiki/run_vc_kntu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sina-rostami/Adobe-Connect-Meetings-Downloader/HEAD/wiki/run_vc_kntu.png -------------------------------------------------------------------------------- /wiki/done_vc_kntu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sina-rostami/Adobe-Connect-Meetings-Downloader/HEAD/wiki/done_vc_kntu.png -------------------------------------------------------------------------------- /export_only.py: -------------------------------------------------------------------------------- 1 | import os 2 | import exporter 3 | 4 | 5 | def export_only(): 6 | for meeting in [x for x in os.listdir('./temp/') if x.endswith('.zip')]: 7 | meeting_name = meeting[:len(meeting) - 4] 8 | exporter.export(meeting_name) 9 | 10 | 11 | if __name__ == '__main__': 12 | export_only() 13 | -------------------------------------------------------------------------------- /exporter.py: -------------------------------------------------------------------------------- 1 | import zipfile 2 | import media_converter 3 | 4 | 5 | def unzip(name): 6 | print('extracting zip file...') 7 | path = './temp/' + name + '.zip' 8 | zipfile.ZipFile(path, 'r').extractall('./temp/' + name) 9 | print('extracted!') 10 | 11 | 12 | def convert(name): 13 | print('converting and merging media....') 14 | if not media_converter.convert_media(name): 15 | print('An error occurred during conversion...') 16 | return 17 | print('converted!') 18 | 19 | 20 | def export(name): 21 | unzip(name) 22 | convert(name) 23 | -------------------------------------------------------------------------------- /iut_vc_dl.py: -------------------------------------------------------------------------------- 1 | from downloader import Downloader 2 | import time 3 | import re 4 | import exporter 5 | 6 | def iut_download(user_name, password, pasted_urls): 7 | 8 | iut_headers = { 9 | 'User-Agent' : 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36', 10 | } 11 | 12 | iut_login_data = { 13 | 'anchor' : '', 14 | 'username' : user_name, 15 | 'password' : password, 16 | 'rememberusername' : '0' 17 | } 18 | 19 | iut_downloader = Downloader('https://elearning.iut.ac.ir/login/index.php', 20 | 'https://ve.iut.ac.ir/', 21 | iut_login_data, iut_headers, iut_headers) 22 | 23 | if not iut_downloader.login({'logintoken'}): 24 | return 25 | 26 | for url in pasted_urls: 27 | if re.match(r'https://elearning\d*\.iut\.ac\.ir/mod/adobeconnect/joinrecording\.php.*', url): 28 | meeting_id=re.findall('recording=(\d+)&', url)[0] 29 | if not iut_downloader.download_meeting(url): 30 | print('An error occurred during download...') 31 | time.sleep(10) 32 | continue 33 | exporter.export(meeting_id) 34 | iut_downloader.download_other_files() 35 | print(meeting_id + ' is ready!') 36 | else: 37 | print('Wrong URL format') 38 | time.sleep(10) 39 | 40 | iut_downloader.remove_temp_directory() 41 | 42 | if __name__ == '__main__': 43 | with open('info.txt', 'r') as f: 44 | lines = f.read().splitlines() 45 | user_name = lines[0] 46 | password = lines[1] 47 | iut_download(user_name, password, lines[2:]) 48 | -------------------------------------------------------------------------------- /kntu_vc_dl.py: -------------------------------------------------------------------------------- 1 | from downloader import Downloader 2 | import time 3 | import re 4 | import exporter 5 | 6 | def kntu_download(user_name, password, pasted_urls): 7 | 8 | kntu_headers = { 9 | 'User-Agent' : 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36', 10 | } 11 | 12 | kntu_login_data = { 13 | 'anchor' : '', 14 | 'username' : user_name, 15 | 'password' : password, 16 | 'rememberusername' : '0' 17 | } 18 | 19 | kntu_downloader = Downloader('https://vc4011.kntu.ac.ir/login/index.php', 20 | 'https://connect4011.kntu.ac.ir/', 21 | kntu_login_data, kntu_headers, kntu_headers) 22 | 23 | if not kntu_downloader.login({'logintoken'}): 24 | return 25 | 26 | for url in pasted_urls: 27 | if re.match(r'https://vc\d*\.kntu\.ac\.ir/mod/adobeconnect/joinrecording\.php.*', url): 28 | meeting_id=re.findall('recording=(\d+)&', url)[0] 29 | if not kntu_downloader.download_meeting(url): 30 | print('An error occurred during download...') 31 | time.sleep(10) 32 | continue 33 | exporter.export(meeting_id) 34 | kntu_downloader.download_other_files() 35 | print(meeting_id + ' is ready!') 36 | else: 37 | print('Wrong URL format') 38 | time.sleep(10) 39 | 40 | kntu_downloader.remove_temp_directory() 41 | 42 | if __name__ == '__main__': 43 | with open('info.txt', 'r') as f: 44 | lines = f.read().splitlines() 45 | user_name = lines[0] 46 | password = lines[1] 47 | kntu_download(user_name, password, lines[2:]) 48 | -------------------------------------------------------------------------------- /ikiu_vc_dl.py: -------------------------------------------------------------------------------- 1 | from downloader import Downloader 2 | import time 3 | import re 4 | import exporter 5 | 6 | 7 | def ikiu_download(user_name, password, pasted_urls): 8 | 9 | headers = { 10 | 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36', 11 | } 12 | 13 | login_data = { 14 | 'anchor': '', 15 | 'username': user_name, 16 | 'password': password, 17 | 'rememberusername': '0' 18 | } 19 | 20 | ikiu_downloader = Downloader('http://lms.ikiu.ac.ir/blocks/whc_backup/login.php', 21 | 'https://ac.aminidc.com', 22 | login_data, headers, headers) 23 | 24 | if not ikiu_downloader.login({'logintoken'}): 25 | return 26 | 27 | for url in pasted_urls: 28 | if re.match(r'https://ac\.aminidc\.com/(.*)/.*', url): 29 | filename=re.findall('recording=(\d+)&', url)[0] 30 | print('Downloading ' + filename + '...') 31 | if not ikiu_downloader.download_meeting(url): 32 | print('An error occurred during download...') 33 | time.sleep(10) 34 | continue 35 | exporter.export(filename) 36 | ikiu_downloader.download_other_files() 37 | print(filename + ' is ready!') 38 | else: 39 | print('Wrong URL format') 40 | time.sleep(10) 41 | 42 | ikiu_downloader.remove_temp_directory() 43 | 44 | if __name__ == '__main__': 45 | with open('info.txt', 'r') as f: 46 | lines = f.read().splitlines() 47 | user_name = lines[0] 48 | password = lines[1] 49 | ikiu_download(user_name, password, lines[2:]) 50 | -------------------------------------------------------------------------------- /ut_vc_dl.py: -------------------------------------------------------------------------------- 1 | from downloader import Downloader 2 | import exporter 3 | import os 4 | import re 5 | import shutil 6 | import time 7 | 8 | def ut_download(user_name, password, pasted_urls): 9 | 10 | ut_headers = { 11 | 'User-Agent' : 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36', 12 | } 13 | 14 | ut_login_data = { 15 | 'username' : user_name, 16 | 'password' : password, 17 | '_eventId' : 'submit', 18 | 'geolocation' : '', 19 | 'submit' : 'LOGIN' 20 | } 21 | 22 | ut_downloader = Downloader('http://elearn.ut.ac.ir/', '', ut_login_data, ut_headers, ut_headers) 23 | 24 | if not ut_downloader.login({'execution'}): 25 | print("username or password is incorrect!") 26 | time.sleep(10) 27 | return 28 | 29 | for url in pasted_urls: 30 | if re.match(r'https://elearn\d*\.ut\.ac\.ir/mod/adobeconnect\d*/joinrecording\.php.*', url): 31 | filename=re.findall('recording=(\d+)&', url)[0] 32 | if not ut_downloader.download_meeting(url): 33 | print('An error occurred during download...') 34 | time.sleep(10) 35 | continue 36 | exporter.export(filename) 37 | ut_downloader.download_other_files() 38 | print(filename + ' is ready!') 39 | else: 40 | print('Wrong URL format') 41 | time.sleep(10) 42 | 43 | ut_downloader.remove_temp_directory() 44 | 45 | if __name__ == '__main__': 46 | with open('info.txt', 'r') as f: 47 | lines = f.read().splitlines() 48 | user_name = lines[0] 49 | password = lines[1] 50 | ut_download(user_name, password, lines[2:]) 51 | -------------------------------------------------------------------------------- /GUI.py: -------------------------------------------------------------------------------- 1 | from tkinter import Scrollbar 2 | from tkinter.constants import CENTER 3 | import PySimpleGUI as sg 4 | import export_only 5 | import kntu_vc_dl 6 | import ut_vc_dl 7 | import iut_vc_dl 8 | import ikiu_vc_dl 9 | 10 | sg.theme("Topanga") 11 | 12 | 13 | def download_meeting(values, window): 14 | window.close() 15 | pasted_urls = [l for l in values['-LINKS-'].split("\n") if len(l) > 0] 16 | if values['-UNI-'] == 'Khaje Nasir Toosi University Of Technology': 17 | kntu_vc_dl.kntu_download( 18 | values['-USERNAME-'], values['-PASSWD-'], pasted_urls) 19 | elif values['-UNI-'] == 'University Of Tehran': 20 | ut_vc_dl.ut_download(values['-USERNAME-'], values['-PASSWD-'], pasted_urls) 21 | elif values['-UNI-'] == 'Isfahan University Of Technology': 22 | iut_vc_dl.iut_download(values['-USERNAME-'], values['-PASSWD-'], pasted_urls) 23 | elif values['-UNI-'] == 'Imam Khomeini International University': 24 | ikiu_vc_dl.ikiu_download(values['-USERNAME-'], values['-PASSWD-'], pasted_urls) 25 | 26 | 27 | layout = [ 28 | [sg.T('"Adobe Connect Meetings Tools"', pad=(220, 0))], 29 | [sg.T('University:')], [sg.Combo(['Khaje Nasir Toosi University Of Technology', 'University Of Tehran', 'Isfahan University Of Technology','Imam Khomeini International University'], key='-UNI-')], 30 | [sg.T('Username:')], [sg.Input(key='-USERNAME-', size=(25, 1))], 31 | [sg.T('Password:')], [sg.Input(key='-PASSWD-', size=(25, 1))], 32 | [sg.T('Mettings Links:')], [sg.MLine(key='-LINKS-', size=(150, 8))], 33 | [sg.Button('Download'), sg.Button('Export-Only')], 34 | ] 35 | 36 | window = sg.Window('Adobe Connect Meetings Tools', 37 | layout, size=(800, 450), grab_anywhere=True, resizable=True) 38 | 39 | while True: 40 | event, values = window.read() 41 | 42 | if event == sg.WIN_CLOSED: 43 | break 44 | 45 | elif event == "Download": 46 | download_meeting(values, window) 47 | break 48 | elif event == "Export-Only": 49 | window.close() 50 | export_only.export_only() 51 | break 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Adobe-Connect-Based-Meetings-Downloader
3 | دانلودر جلسات ادوبی کانکت
4 | آموزش فارسی
5 |

6 | 7 | 8 | ### requirements 9 | 10 | it's enough to just you've installed `python` and `pip` on your device. 11 | 12 | then to install requierments for the first time 13 | run the command below in your terminal in the repository directory: 14 | 15 | ```bash 16 | pip install -r requirements.txt 17 | ``` 18 | 19 | 20 | ### Usage 21 | 22 | + simply run `GUI.py` file for the Graphical User Interface (for export-only mode, you should first follow cli instructions): 23 | 24 | ```bash 25 | python GUI.py 26 | ``` 27 | 28 | or to use Command Line Interface (CLI) follow these steps : 29 | 30 | + to use full-featured mode: 31 | + open `info.txt` file,
32 | + replace username and password with your username and password,
33 | + paste links you want to download in place of urls 34 | + run your university module. 35 | >#### KNTU 36 | >``` 37 | >python kntu_vc_dl.py 38 | >``` 39 | 40 |
41 | 42 | + and if your institute isn't supported yet, you can use export-only mode by following these steps: 43 | + open your recorded class in browser. 44 | + it's link must be something like this :
45 | `my-uni.com/ABCDEFGHIJK/...*` 46 | + change it to this format:
47 | `my-uni.com/ABCDEFGHIJK/output/temp.zip?download=zip` 48 | + paste generated link in the same tab and press enter. 49 | + a file named `temp.zip` starts downloading. 50 | + create a directory named `temp` in repository and move all your zip files in it. 51 | + now run this command:
52 | `python export_only.py` 53 | 54 | 55 | 56 | #### Example 57 | 58 | After editing the `info.txt` file, it should be like this:
59 | ``` 60 | 61 | 9123456 62 | mypassword 63 | https://vc.kntu.ac.ir/mod/adobeconnect/joinrecording.php?id=1111&recording=2222&groupid=0&sesskey=aaaaaaa 64 | https://vc.kntu.ac.ir/mod/adobeconnect/joinrecording.php?id=2222&recording=3333&groupid=0&sesskey=bbbbbbb 65 | ``` 66 | 67 | ### Supported Univesities 68 | 69 | + Khaje Nasir Toosi University Of Technology 70 | + University Of Tehran 71 | + Isfahan University Of Technology 72 | + Imam Khomeini International University 73 | -------------------------------------------------------------------------------- /media_converter.py: -------------------------------------------------------------------------------- 1 | import ffmpeg 2 | import xmltodict 3 | import os 4 | import re 5 | 6 | 7 | def does_camera_voip_have_attribute(file_name, name, attribute): 8 | xml_path = f'./temp/{file_name}/{name[:-4]}.xml' 9 | with open(xml_path) as file: 10 | camera_voip = xmltodict.parse(file.read()) 11 | 12 | return attribute in camera_voip['root']['Flag'] 13 | 14 | def convert_media(meeting_id): 15 | # for debugging change from 'quiet' to 'info' 16 | log_level = 'quiet' 17 | 18 | meeting_temp_path = './temp/' + meeting_id + '/' 19 | output_path = './output/' + meeting_id + '/' 20 | 21 | if not os.path.exists('./output/' + meeting_id): 22 | os.makedirs(output_path) 23 | 24 | time_table = get_events_time_table(meeting_id) 25 | videos = [] 26 | prev_scrnshr = "" 27 | for item in time_table: 28 | if str(item).startswith('screenshare') or not does_camera_voip_have_attribute(meeting_id, item, "video"): 29 | vid = ffmpeg.input(meeting_temp_path + item).video 30 | try: 31 | ffmpeg.run(ffmpeg.output(vid, output_path + item.split('.')[0] + '.mp4', f='flv', c='copy', loglevel=log_level), overwrite_output=True) 32 | except: 33 | pass 34 | 35 | audios = [] 36 | camera_voips = [f for f in os.listdir(meeting_temp_path) if re.match('cameraVoip.+\.flv', f)] 37 | for camera_voip in camera_voips: 38 | if camera_voip in time_table and does_camera_voip_have_attribute(meeting_id, camera_voip, "audio"): 39 | aud = ffmpeg.input(meeting_temp_path + camera_voip).audio 40 | audios.append(ffmpeg.filter(aud, 'adelay', '{}ms'.format(time_table[camera_voip][0]))) 41 | 42 | if len(audios) > 1: 43 | aud_out = ffmpeg.filter(audios, 'amix', inputs=len(audios)) 44 | else: 45 | aud_out = audios[0] 46 | 47 | stream = ffmpeg.output(aud_out, output_path + 'meeting_audio.mp3', loglevel=log_level) 48 | try: 49 | ffmpeg.run(stream, overwrite_output=True) 50 | return True 51 | except Exception as e: 52 | return False 53 | 54 | 55 | def get_events_time_table(file_name): 56 | mainstream_path = './temp/' + file_name + '/mainstream.xml' 57 | with open(mainstream_path) as file: 58 | mainstream = xmltodict.parse(file.read()) 59 | first_stream = None 60 | time_table = {} 61 | for event in mainstream['root']['Message']: 62 | if event.get('Method') and event.get('String') and event.get('Array') and event.get('Array').get('Object'): 63 | if event.get('String') != "streamAdded" and event.get('String') != "streamRemoved": 64 | continue 65 | event_name = event['Array']['Object']['streamName'].replace('/', '') + '.flv' 66 | if not first_stream: 67 | first_stream = event_name 68 | if event.get('String') == "streamAdded": 69 | if not event_name in time_table: 70 | time_table[event_name] = list() 71 | time_table[event_name].append(int(event['@time'])) 72 | elif event.get('String') == "streamRemoved": 73 | end_time = int(event['@time']) 74 | if end_time > time_table[event_name][0]: 75 | time_table[event_name].append(end_time) 76 | else: 77 | time_table.pop(event_name) 78 | 79 | for ev in time_table: 80 | time_table[ev][0] = time_table[ev][0] - time_table[first_stream][0] 81 | if len(time_table[ev]) == 2: 82 | time_table[ev][1] = time_table[ev][1] - time_table[first_stream][0] 83 | 84 | return time_table 85 | 86 | 87 | if __name__ == "__main__": 88 | convert_media(input()) -------------------------------------------------------------------------------- /downloader.py: -------------------------------------------------------------------------------- 1 | import re 2 | import xml.etree.ElementTree as ET 3 | import requests 4 | import os 5 | from bs4 import BeautifulSoup 6 | from requests.sessions import session 7 | import zipfile 8 | import shutil 9 | from tqdm import tqdm 10 | import time 11 | import exporter 12 | 13 | from media_converter import convert_media 14 | 15 | 16 | class Downloader: 17 | 18 | def __init__(self, 19 | login_page_url, base_download_url, 20 | login_data, 21 | login_headers, download_headers): 22 | print('Preparing...') 23 | requests.packages.urllib3.disable_warnings() 24 | self.login_page_url = login_page_url 25 | self.base_download_url = base_download_url 26 | self.pasted_url = None 27 | self.login_data = login_data 28 | self.login_headers = login_headers 29 | self.download_headers = download_headers 30 | self.dl_session = requests.Session() 31 | self.name_to_save = None 32 | self.download_link = None 33 | self.meeting_page_req = None 34 | 35 | def set_pasted_url(self, url): 36 | self.pasted_url = url 37 | 38 | def set_name_to_save(self, name): 39 | self.name_to_save = name 40 | 41 | def login(self, extra_data): 42 | print('Logging in...') 43 | req = self.dl_session.get( 44 | self.login_page_url, headers=self.login_headers, verify=False) 45 | soup = BeautifulSoup(req.content, 'html5lib') 46 | for elem in extra_data: 47 | self.login_data[elem] = soup.find( 48 | 'input', attrs={'name': elem})['value'] 49 | post = self.dl_session.post(req.url, 50 | data=self.login_data, headers=self.login_headers, verify=False) 51 | if "Invalid credentials" in post.text or "loginerrormessage" in post.text: 52 | print("Username or Password is Incorrect") 53 | time.sleep(10) 54 | return False 55 | soup = BeautifulSoup(post.content, 'html5lib') 56 | if 'user_radio_0' in post.text: 57 | post = self.dl_session.post(post.url, data={'rdb': soup.find('input', attrs={ 58 | 'name': 'rdb', 'id': 'user_radio_0'})['value'], 'button': 'Log in'}, headers=self.login_headers, verify=False) 59 | self.set_cookies() 60 | print('Logged in!') 61 | return True 62 | 63 | def set_cookies(self): 64 | print('Setting cookies...') 65 | session_cookie = '' 66 | for item in self.dl_session.cookies.get_dict(): 67 | session_cookie = session_cookie + item + "=" + \ 68 | self.dl_session.cookies.get_dict()[item] + "; " 69 | self.download_headers['Cookie'] = session_cookie 70 | print('Cookies set!') 71 | 72 | def create_downlaod_link(self): 73 | print('Creating download link...') 74 | self.meeting_page_req = self.dl_session.get( 75 | self.pasted_url, headers=self.download_headers, verify=False) 76 | 77 | self.set_cookies() 78 | try: 79 | host_value = re.findall( 80 | r'var hostValue = \'(.*)\';', self.meeting_page_req.text)[0] 81 | url_path = re.findall( 82 | r'var urlPath = \'(/\w+/)\';', self.meeting_page_req.text)[0] 83 | except: 84 | print("Invalid Link (maybe you are not authorized!)") 85 | time.sleep(10) 86 | return False 87 | self.base_download_url = host_value 88 | self.download_link = host_value + \ 89 | url_path + 'output/temp.zip?download=zip' 90 | print('Download link created!') 91 | return True 92 | 93 | def download_file(self): 94 | print('Downloading...') 95 | try: 96 | self.download_req = self.dl_session.get( 97 | self.download_link, headers=self.download_headers, stream=True, verify=False) 98 | if not os.path.exists('temp'): 99 | os.mkdir('temp') 100 | with open('./temp/'+self.name_to_save+'.zip', 'wb') as file: 101 | t = tqdm(unit_scale=True, desc=self.name_to_save, 102 | unit='B', total=int(self.download_req.headers['content-length'])) 103 | for data in self.download_req.iter_content(8192): 104 | file.write(data) 105 | t.update(8192) 106 | t.close() 107 | print(self.name_to_save + ' Downloaded and Saved') 108 | return True 109 | except: 110 | return False 111 | 112 | def download_meeting(self, url): 113 | self.set_name_to_save(re.findall('recording=(\d+)&', url)[0]) 114 | self.set_pasted_url(url) 115 | if not self.create_downlaod_link(): 116 | return False 117 | return self.download_file() 118 | 119 | def download_other_files(self): 120 | output_directory = './output/'+self.name_to_save+'/' 121 | if not os.path.exists(output_directory): 122 | os.makedirs(output_directory) 123 | print('Downloading other files...') 124 | index_stream_xml = ET.parse( 125 | './temp/' + self.name_to_save + '/indexstream.xml') 126 | for arr in index_stream_xml.findall('Message'): 127 | if int(arr.get('time')) > 0: 128 | files = arr.findall( 129 | 'Array/Object/newValue/documentDescriptor') 130 | for file in list(files): 131 | try: 132 | if file.find('downloadUrl').text != None: 133 | file_name = re.split( 134 | '/', file.find('downloadUrl').text)[6][6:] 135 | file_url = self.base_download_url + '/' + re.split('/', file.find('downloadUrl').text)[4] + '/source/' + \ 136 | file_name + '?download=true' 137 | elif file.find('registerContentUrl').text != None: 138 | file_name = file.find('theName').text 139 | prefix = re.split( 140 | '/', file.find('registerContentUrl').text)[1] 141 | file_url = self.base_download_url + '/' + prefix + '/output/' + file_name 142 | file_name = requests.utils.unquote(file_name) 143 | path_to_save = './output/' + self.name_to_save + \ 144 | '/' + file_name 145 | if os.path.isfile(path_to_save): 146 | continue 147 | print('Downloading ' + file_name) 148 | with self.dl_session.get(file_url, stream=True) as req: 149 | with open(path_to_save, 'wb') as file_file: 150 | t = tqdm(unit_scale=True, desc=file_name, 151 | unit='B', total=int(req.headers['content-length'])) 152 | for data in req.iter_content(8192): 153 | file_file.write(data) 154 | t.update(8192) 155 | t.close() 156 | except: 157 | continue 158 | print('other files Downloaded!') 159 | 160 | def remove_temp_directory(self): 161 | if os.path.isdir('./temp'): 162 | shutil.rmtree('./temp') 163 | if os.path.isdir('./__pycache__'): 164 | shutil.rmtree('./__pycache__') 165 | --------------------------------------------------------------------------------