Skip to content

Instantly share code, notes, and snippets.

@tshu-w
Created December 30, 2022 13:43
Show Gist options
  • Save tshu-w/9249802c06db792a705b10ff9ee8d1b8 to your computer and use it in GitHub Desktop.
Save tshu-w/9249802c06db792a705b10ff9ee8d1b8 to your computer and use it in GitHub Desktop.
Backup Community Edition Overleaf Project
#!/usr/bin/env sh
HOST="overleaf.cipsup.cn"
PROJECT_ID="627220cc14ecd4008b9ae727"
DIRECTORY="$HOME/Library/CloudStorage/OneDrive-Personal/Backups/Overleaf/$PROJECT_ID"
OUTPUT="main_`date +"%Y-%m-%dT%H%M"`.zip"
COOKIE="$OVERLEAF_COOKIE"
curl "http://$HOST/project/$PROJECT_ID/download/zip" \
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15" \
-H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" \
-H "Accept-Language: en-US,en;q=0.9" \
-H "Accept-Encoding: gzip, deflate" \
-H "Upgrade-Insecure-Requests: 1" \
-H "Cookie: sharelatex.sid=$COOKIE" \
--output "$DIRECTORY/$OUTPUT" --create-dirs
find "$DIRECTORY/" -mindepth 1 -type f -mtime +2 -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment