instagram: fixes share urls
This commit is contained in:
parent
34219a848e
commit
3e307658fa
5 changed files with 33 additions and 9 deletions
10
util/misc.go
10
util/misc.go
|
@ -21,7 +21,7 @@ var cookiesCache = make(map[string][]*http.Cookie)
|
|||
func GetLocationURL(
|
||||
client models.HTTPClient,
|
||||
url string,
|
||||
userAgent string,
|
||||
headers map[string]string,
|
||||
) (string, error) {
|
||||
if client == nil {
|
||||
client = GetDefaultHTTPClient()
|
||||
|
@ -30,10 +30,12 @@ func GetLocationURL(
|
|||
if err != nil {
|
||||
return "", fmt.Errorf("failed to create request: %w", err)
|
||||
}
|
||||
if userAgent == "" {
|
||||
userAgent = ChromeUA
|
||||
for k, v := range headers {
|
||||
req.Header.Set(k, v)
|
||||
}
|
||||
if req.Header.Get("User-Agent") == "" {
|
||||
req.Header.Set("User-Agent", ChromeUA)
|
||||
}
|
||||
req.Header.Set("User-Agent", userAgent)
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to send request: %w", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue