Skip to content

Commit

Permalink
fix URL Encode
Browse files Browse the repository at this point in the history
  • Loading branch information
Sniij committed Jan 5, 2025
1 parent 193763f commit a719c8e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions crawling/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"log"
"net/http"
"net/url"
"os"
"strings"
"sync"
Expand Down Expand Up @@ -34,9 +35,15 @@ func init() {
log.Println("No .env file found. Falling back to system environment variables.")
}
}

BASE_URL = os.Getenv("BASE_URL")
BASE_URL_DETAIL = os.Getenv("BASE_URL_DETAIL")
var err error
BASE_URL, err = url.QueryUnescape(os.Getenv("BASE_URL"))
if err != nil {
log.Printf("failed to get server url: %v", err)
}
BASE_URL_DETAIL, err = url.QueryUnescape(os.Getenv("BASE_URL_DETAIL"))
if err != nil {
log.Printf("failed to get server url: %v", err)
}
}

// FetchHTML fetches the HTML document from a given URL.
Expand Down

0 comments on commit a719c8e

Please sign in to comment.