overleaf-sync
overleaf-sync copied to clipboard
Error: Project details could not be queried.
I can obtain the project list with ols list
, but I got an error when I do ols -l
or ols -r
to sync files.
Project queried successfully. ✅ Querying project 💥 Querying project details Error: Project details could not be queried.
Same problem here, I could not download the project files
Same here, more info:
> ols -v -n 'PROJECT' -r
Project queried successfully.
✅ Querying project
⠋ Querying project detailsTraceback (most recent call last):
File "/home/user/.local/lib/python3.10/site-packages/olsync/olsync.py", line 348, in execute_action
success = action()
File "/home/user/.local/lib/python3.10/site-packages/olsync/olsync.py", line 73, in <lambda>
lambda: overleaf_client.get_project_infos(project["id"]),
File "/home/user/.local/lib/python3.10/site-packages/olsync/olclient.py", line 167, in get_project_infos
self._cookie["GCLB"],
KeyError: 'GCLB'
💥 Querying project details
Error: Project details could not be queried.
That line reads:
164 # Convert cookie from CookieJar to string
165 cookie = "GCLB={}; overleaf_session2={}" \
166 .format(
167 self._cookie["GCLB"],
168 self._cookie["overleaf_session2"]
169 )
That self._cookie would probably need to come from OverleafClient.login() which states, that its DEPRECATED. I hope that helps a bit.
Same issue, itstorque's commit remedied this after generating a new login cookie
After getting the same error itstorque's commit fixed it but today a different error message appeared. Using linux
>> ols login
Persisted Overleaf cookie already exist. Do you want to override it? [y/N]: y
⠸ Loginjs: Uncaught TypeError: Cannot read properties of undefined (reading 'href')
js: Uncaught TypeError: Cannot read properties of undefined (reading 'content')
Login successful. Cookie persisted as `.olauth`. You may now sync your project.
✅ Login
>> ols -r
💥 Querying project
Error: Project could not be queried.
Hi @CeciliaCoelho, @itstorque's commit also stopped working for me. It seems Overleaf has made some changes on the website. These modifications (see #66) worked for me.
Took a look at the rendered HTML for the landing page, they removed the classes for the links in the table. I think replacing the line
JAVASCRIPT_EXTRACT_PROJECT_URL = "document.getElementsByClassName('project-list-table-name-link')[0].href"
with this
JAVASCRIPT_EXTRACT_PROJECT_URL = "document.getElementsByTagName('tbody')[0].children[0].getElementsByTagName('a')[0].href"
should work. Its very jank, if they introduce another table in the HTML before the project list, it will break.
Another possible implementation that I prefer would be replacing that line with
JAVASCRIPT_EXTRACT_PROJECT_URL = "q=0;for (const c of document.getElementsByTagName('a')) { if(c.href.indexOf('/project/') > 0) { q=c.href; break; } }; q"
The thinking here is that support for URLs is more concrete (backcompatibility) and therefore changes to the html page wouldn't break the ability to find a link to a project to load the GCLB cookie.
Note: I didn't test these, but I am confident that they should work (lmk otherwise)
I think this alone doesn't do the trick. Additionally, I had to do two changes in class OverleafClient(object)
in the methods that deal with querying the project (def all_projects(self)
and def get_project(self)
). (see #66)
I don't know how the old landing page looked like, but it may be due to the same design changes.
~~I replaced the files in the pip module with the fixes from the linked repository in #66, but I am getting the following issue using ols download -v
(with a fresh login token)~~
Traceback (most recent call last):
File "/home/user/.local/lib/python3.11/site-packages/olsync/olsync.py", line 354, in execute_action
success = action()
^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/olsync/olsync.py", line 179, in download_project_pdf
project = execute_action(
^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/olsync/olsync.py", line 365, in execute_action
raise click.ClickException(fail_message)
click.exceptions.ClickException: Project could not be queried.
💥 Downloading project's PDF
Error: Downloading project's PDF failed. Please try again.
EDIT:
User error, I forgot to select the project I want to sync / download.
correct command to do is: ols download -n my_project
the fix works perfectly!