Skip to content

Commit

Permalink
add USER_AGENT env var
Browse files Browse the repository at this point in the history
  • Loading branch information
sonroyaalmerol committed Mar 2, 2024
1 parent db38a94 commit ef963ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ This will start the M3U Stream Merger Proxy, and you can access it at `http://lo

- **M3U_URL_1, M3U_URL_2, M3U_URL_X**: Set the M3U URLs as environment variables in the `.env` file.

- **USER_AGENT**: Set the User-Agent of all HTTP requests. Default is `IPTV Smarters/1.0.3 (iPad; iOS 16.6.1; Scale/2.00)`.

- **UPDATE_INTERVAL**: (Optional) Set the update interval in hours. Default is 24 hours.

### Endpoints
Expand Down
6 changes: 5 additions & 1 deletion m3u/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"fmt"
"net/http"
"os"
"regexp"
"strings"

Expand All @@ -12,7 +13,10 @@ import (

func ParseM3UFromURL(m3uURL string, m3uIndex int) (error) {
// Set the custom User-Agent header
userAgent := "IPTV Smarters/1.0.3 (iPad; iOS 16.6.1; Scale/2.00)"
userAgent, userAgentExists := os.LookupEnv("USER_AGENT")
if !userAgentExists {
userAgent = "IPTV Smarters/1.0.3 (iPad; iOS 16.6.1; Scale/2.00)"
}

// Create a new HTTP client with a custom User-Agent header
client := &http.Client{
Expand Down

0 comments on commit ef963ea

Please sign in to comment.