diff --git a/src/usr/local/kobocloud/getDropboxFiles.sh b/src/usr/local/kobocloud/getDropboxFiles.sh index 647e129..4e53059 100755 --- a/src/usr/local/kobocloud/getDropboxFiles.sh +++ b/src/usr/local/kobocloud/getDropboxFiles.sh @@ -9,13 +9,19 @@ source `dirname $0`/config.sh # get directory listing echo "Getting $baseURL" # get directory listing -$CURL -k -L --silent "$baseURL" | # get listing -grep -o ']*class="thumb-link [^"]*">' | # find links -sed -e 's/.*href="\([^"]*\)".*/\1/' | # extract links and replace ampersands +$CURL -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36" -k -L --silent "$baseURL" | # get listing. Need to specify a user agent, otherwise it will download the directory +grep -Eo 'previews\.dropboxusercontent\.com.*' | +grep -Eo 'https?://www.dropbox.com/sh/[^\"]*' | # find links while read linkLine do + if [ "$linkLine" = "$baseURL" ] + then + continue + fi + #echo $linkLine # process line outFileName=`echo $linkLine | sed -e 's|.*/\(.*\)?dl=.*|\1|'` + #echo $outFileName localFile="$outDir/$outFileName" `dirname $0`/getRemoteFile.sh "$linkLine" "$localFile" done diff --git a/src/usr/local/kobocloud/getRemoteFile.sh b/src/usr/local/kobocloud/getRemoteFile.sh index 0bfb0cf..d5b679a 100755 --- a/src/usr/local/kobocloud/getRemoteFile.sh +++ b/src/usr/local/kobocloud/getRemoteFile.sh @@ -8,7 +8,7 @@ source `dirname $0`/config.sh echo "$linkLine -> $localFile" -remoteSize=`$CURL -k -L --silent --head "$linkLine" | sed -n 's/^Content-Length\: \([0-9]*\).*/\1/p'` +remoteSize=`$CURL -k -L --silent --head "$linkLine" | sed -n 's/^Content-Length\: \([0-9]*\).*/\1/ip'` if [ -f $localFile ]; then localSize=`stat -c%s "$localFile"` else @@ -22,4 +22,4 @@ else echo "Error resuming: redownload file" $CURL -k --silent -L -o "$localFile" "$linkLine" # restart download fi -fi \ No newline at end of file +fi