philippta / flyscrape

Flyscrape is a command-line web scraping tool designed for those without advanced programming skills.
https://flyscrape.com
Mozilla Public License 2.0
1.04k stars 31 forks source link

Detailed guide on compiling from source #40

Open dynabler opened 8 months ago

dynabler commented 8 months ago

How do I compile Flyscrape from source? The docs say:

go install github.com/philippta/flyscrape/cmd/flyscrape@latest

But I downloaded a zip file, unpacked, changed some code and did go build

I also did go build flyscrape.go/scrape.go etc.

And nothing happened. Am I missing something?

philippta commented 8 months ago

Note: You do not have to download the source code from GitHub (as zip) in order to install flyscrape from source. The Go compiler (which you will install) does all that for you behind the scenes.

  1. Download and install the Go compiler by following the official installation instructions: https://go.dev/doc/install
  2. Open a new Terminal / Command Prompt and enter the go install command: go install github.com/philippta/flyscrape/cmd/flyscrape@latest
  3. Once the command has finished you should find the compiled program in either ~/go/bin/flyscrape (if you are on Mac or Linux) or C:\Users\yourusername\go\bin\flyscrape (if you are on Windows)
  4. You can run it from there or copy it wherever you like.

In case you want to modify the source code before compiling it you can do the following:

  1. Download and install the Go compiler as described above.
  2. Download the source code as a zip file (which you already have) and extract it.
  3. Open a Terminal / Command Prompt and navigate to that directory where the source code is.
  4. Run the following command: go build ./cmd/flyscrape
  5. Once the command has finished you should find the compiled program (flyscrape or flyscrape.exe) in your current directory.
dynabler commented 8 months ago

The second set of instructions is what I was looking for. I managed to get a flyscrape.exe. But can't get it to run:

cache: failed to create cache table: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub

What's the solution?

philippta commented 8 months ago

I don’t have much experience on windows but you can try running this command before the build command:

set CGO_ENABLED=1