mirror of
https://codeberg.org/pluja/kycnot.me
synced 2024-10-01 01:05:59 -04:00
use custom Getenv with fallback
This commit is contained in:
parent
038ad49ec7
commit
7e259b7cb4
@ -7,12 +7,13 @@ import (
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/http/cookiejar"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/html"
|
||||
|
||||
"pluja.dev/kycnot.me/utils"
|
||||
)
|
||||
|
||||
type ScraperResponse struct {
|
||||
@ -24,10 +25,7 @@ type ScraperResponse struct {
|
||||
func GetBody(url string) (string, error) {
|
||||
// Send a GET request to os.Getenv("SCRAPER_API_URL")/scrap?url=url
|
||||
// Unmarshal the response and return the HTML content
|
||||
scraper_api := os.Getenv("SCRAPER_API_URL")
|
||||
if scraper_api == "" {
|
||||
scraper_api = "http://localhost:3011"
|
||||
}
|
||||
scraper_api := utils.Getenv("SCRAPER_API_URL", "http://localhost:3011")
|
||||
|
||||
// Request the HTML content
|
||||
resp, err := http.Get(fmt.Sprintf("%v/scrap?url=%v", scraper_api, url))
|
||||
|
Loading…
Reference in New Issue
Block a user