zeltox / Google-Drive-PDF-Downloader

MIT License
435 stars 124 forks source link

Compiling go #10

Open VCTR18 opened 3 years ago

VCTR18 commented 3 years ago

I don't know much about the language, can I simply download it and compile the code from main.go or it's somehow more complicated? If it is, could you please facilitate the steps? Thanks in advance

arthur-quadros commented 3 years ago

Hello VCTR18, I awalys use 'Method1_Script' as a north.

To be more precisely, what are your doubts?

VCTR18 commented 3 years ago

i want to compile the binaries in sources. But I can't because it uses a couple of custom libraries

arthurhess commented 3 years ago

+1 on this. I also would like to build from source

VCTR18 commented 3 years ago

+1 on this. I also would like to build from source

I ended up writing a bash script, for linux. Are you interested?

arthurhess commented 3 years ago

Hi, @VCTR18. I just saw your reply. Yes, it would be wonderful if you could share it, thanks!

VCTR18 commented 3 years ago

Hi, @VCTR18. I just saw your reply. Yes, it would be wonderful if you could share it, thanks!

#!/bin/bash

#Requires base64 which I suspect comes with ubuntu and an imageMagick utility called convert
#Also I didn't managed to get the last page, but it's usually the back cover so I didn't lose my sleep for it, i'm sorry
#I use this along method 1, but replacing line 39 with <<anchorElement.download = pdfDocumentName;>>

pos=$(pwd)
mkdir -p "$1"_folder
cd "$1"_folder
mkdir -p pages
cd pages
empt=''
rm="data:image/png;base64,"
counter=0

echo "Extrayendo paginas/Extracting pages"

while read line
do
    if echo "$line" | grep -q $rm; then
        if (( counter )); then
            echo "$data_img" | base64 -di - > $counter.png
        fi
        data_img="${line/$rm/$empt}"
        let "counter++"
    else
        data_img+=$line$'\n'
    fi

done < ../../"$1"

echo "$data_img" | base64 -di - > $counter.png

echo "Páginas extraidas, convirtiendo a pdf/Pages extracted, converting to pdf"

convert $(ls -1v) ../$1.pdf 
cd $pos

echo "PDF completado/PDF completed"

Hope it helps