Xunius / Menotexport

Python solution to export annotations from your Mendeley library.
GNU General Public License v3.0
123 stars 20 forks source link

Updated install instructions and procedure for migrating to Zenodo #35

Open pboley opened 3 years ago

pboley commented 3 years ago

So, it's February 2021 and Elsevier recently announced they will be killing the Mendeley iOS application on March 15th. I guess I am not the only one desperately looking for a way to get out of Mendeley's grasp, despite it having worked reasonably well for so many years. The good news is that the Menotexport tool still mostly works, but it required a few tricks to get it working and get my library fully into Zenodo. I provide my experience here.

Zenodo's direct import from Mendeley works fine; it will copy all the PDFs and preserve your Collection/Folder structure, but you will be missing all your annotations. Menotexport can be used to move the annotations to the PDF files directly, but when importing the .bib or .ris files created by Menotexport to Zenodo my Collection folder was lost somehow. Also, while the annotations were included in the bibliography items, the PDFs were somehow not present.

The solution presented here preserves your Collection/Folder structure and annotates all your PDFs directly in the files.

I did this in macOS using Anaconda, but it will probably work in Linux too (with adjustments to your paths)

  1. Back up your Mendeley directory structure entirely and proceed only at your own risk...
  2. Downgrade to Mendeley v1.18, as higher versions than this began to encrypt your local database for your comfort and convenience.... I suggest you clear your "Downloads" directory in Mendeley first, since you will have to download everything again, and it's better not to have duplicate files there.
  3. Launch Mendeley and resync your library. For me this took several hours to download 1.6GB.
  4. Set up a new conda environment, since you will need Python 2.7; you can delete the environment entirely when you are done and satisfied. There will be some additional dependencies which are not listed in the documentation, and the guangzhi conda channel is gone, so install Menotexport from github.
    conda create -n menotexport python=2.7
    conda activate menotexport
    pip install PyPDF2
    pip install pdfminer.six
    pip install beautifulsoup4
    git clone https://github.com/Xunius/Menotexport
    cd Menotexport
    python setup.py install
  5. Export and annotate your Mendeley PDF files (replace the location of your sqlite file as appropriate). You don't need anything other than the "-p" option, since you won't use the .bib or .ris file for anything.
    python menotexport.py -p ~/Library/Application\ Support/Mendeley\ Desktop/yourlogin\@email.com\@www.mendeley.com.sqlite export
  6. Move the exported PDF files BACK into the Mendeley Downloads directory
    find export -type f -name "*.pdf" -exec mv {} ~/Library/Application\ Support/Mendeley\ Desktop/Downloaded ;/
  7. Import your files directly using the "Mendeley" option in Zenodo import.
  8. (Optional, recommended) Restore your Mendeley backup, as the PDFs there are already annotated (which is not what you want).
Xunius commented 3 years ago

@pboley Many thanks for the very detailed instructions. I'm adding a link to this issue in the README so other Zenodo users may find it useful.

m-zheng commented 3 years ago

Use link below to download the 1.18 version. https://desktop-download.mendeley.com/download/Mendeley-Desktop-1.18-OSX-Universal.dmg

m-zheng commented 3 years ago

Use command below if anyone runs into an error saying "ImportError: No module named bs4"

pip install beautifulsoup4

Read below if step 5 does not work somehow. If you enable "organize my files", "sort files into subfolders", and "rename document files" in "File Orginazer", you must disable "sort files into subfolders" and "rename document files". Then use the path in "organise my files" to replace the_folder_you_store_mendeley_files in command below.

find export -type f -name "*.pdf" -exec mv {} ~/the_folder_you_store_mendeley_files \;
gl-eb commented 3 years ago

Thanks for the instructions! If anyone else could not get it to work exactly as described, here a few minor changes that I had to implement on macOS 11.2.1 in the stadard shell zsh:

After this, import into Zotero using the Mendeley import option worked like a charm.

Edit: Looks like I haven't refreshed the page since @m-zheng posted the same changes. Sorry for the duplicate response. I will still leave this comment up.

samuelhward commented 3 years ago

Anyone know the download links for the 1.18 Ubuntu version?

m-zheng commented 3 years ago

Anyone know the download links for the 1.18 Ubuntu version?

https://desktop-download.mendeley.com/download/apt/pool/main/m/mendeleydesktop/mendeleydesktop_1.18-stable_amd64.deb