-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error when useing ceiba-dl get command #13
Comments
It seems that CEIBA API returns a course which does not exist on https://ceiba.ntu.edu.tw/student/index.php page. |
It seems that courses in 旁聽 have the error described above. Is there any approach to bypass the problem? |
Since I have no course marked as 旁聽 in my account, I can't reproduce the issue myself. Does this patch work for you? diff --git a/ceiba_dl/vfs.py b/ceiba_dl/vfs.py
index a5c6c59..56b6c22 100644
--- a/ceiba_dl/vfs.py
+++ b/ceiba_dl/vfs.py
@@ -394,6 +394,8 @@ class RootCoursesDirectory(Directory):
def search_course_list(self, sn):
if not hasattr(self, '_course_list_map'):
self._create_course_list_map()
+ if sn not in self._course_list_map:
+ return []
return self._course_list_map[sn]
class RootStudentsDirectory(Directory):
You can add the broken directory to the |
It shows the error message: Traceback (most recent call last): |
I am not sure if this patch can work around your problem: diff --git a/ceiba_dl/vfs.py b/ceiba_dl/vfs.py
index a5c6c59..f042aaf 100644
--- a/ceiba_dl/vfs.py
+++ b/ceiba_dl/vfs.py
@@ -394,6 +394,8 @@ class RootCoursesDirectory(Directory):
def search_course_list(self, sn):
if not hasattr(self, '_course_list_map'):
self._create_course_list_map()
+ if sn not in self._course_list_map:
+ return [[]] * 8
return self._course_list_map[sn]
class RootStudentsDirectory(Directory): Since I have no access to your data, it is unlikely that I am able to come up with a working patch for you. The entire project is built on undocumented interfaces of NTU CEIBA, so it is impossible for me to make it reliable. Therefore, when you see an issue, it is recommended to debug and fix it yourself and submit the patch after you resolve the issue. If you can't fix it, please use |
This works for me since 旁聽 courses are just listed on table 2 diff --git a/ceiba_dl/vfs.py b/ceiba_dl/vfs.py
old mode 100644
new mode 100755
index a5c6c59..d5b8ec7
--- a/ceiba_dl/vfs.py
+++ b/ceiba_dl/vfs.py
@@ -353,6 +353,7 @@ class RootCoursesDirectory(Directory):
course_list_page = self.vfs.request.web('/student/index.php')
course_list_rows_all = course_list_page.xpath('//table[1]/tr')
course_list_rows = course_list_rows_all[1:]
+ course_list_rows += course_list_page.xpath('//table[2]/tr')[1:]
course_list_header_row = course_list_rows_all[0] |
Sorry, it doesn't work for me because I have no 旁聽 courses, and the second table has the title '以下為您修習的課程,並未於CEIBA上開設課程網頁' instead, which causes
|
$ ceiba-dl get
Traceback (most recent call last):
File "/usr/local/bin/ceiba-dl", line 243, in
exit(0 if args.func(args, config) else 1)
File "/usr/local/bin/ceiba-dl", line 141, in run_get
end_download_callback=end_callback)
File "/usr/local/lib/python3.5/site-packages/ceiba_dl/init.py", line 388, in run
download_progress_callback, end_download_callback)
File "/usr/local/lib/python3.5/site-packages/ceiba_dl/init.py", line 232, in download_file
if not self.download_file(child_path, retry, dcb, ecb):
File "/usr/local/lib/python3.5/site-packages/ceiba_dl/init.py", line 232, in download_file
if not self.download_file(child_path, retry, dcb, ecb):
File "/usr/local/lib/python3.5/site-packages/ceiba_dl/init.py", line 232, in download_file
if not self.download_file(child_path, retry, dcb, ecb):
File "/usr/local/lib/python3.5/site-packages/ceiba_dl/init.py", line 214, in download_file
node = self.vfs.open(path)
File "/usr/local/lib/python3.5/site-packages/ceiba_dl/vfs.py", line 40, in open
work.fetch()
File "/usr/local/lib/python3.5/site-packages/ceiba_dl/vfs.py", line 979, in fetch
course_list_row = self.vfs.root.courses.search_course_list(self._sn)
File "/usr/local/lib/python3.5/site-packages/ceiba_dl/vfs.py", line 397, in search_course_list
return self._course_list_map[sn]
KeyError: '0ff983'
The text was updated successfully, but these errors were encountered: