instagram: fixes
This commit is contained in:
parent
7dab9207b7
commit
34219a848e
5 changed files with 15 additions and 19 deletions
|
@ -74,22 +74,12 @@ var ShareURLExtractor = &models.Extractor{
|
|||
|
||||
Run: func(ctx *models.DownloadContext) (*models.ExtractorResponse, error) {
|
||||
client := util.GetHTTPClient(ctx.Extractor.CodeName)
|
||||
req, err := http.NewRequest(
|
||||
http.MethodGet,
|
||||
ctx.MatchedContentURL,
|
||||
nil,
|
||||
)
|
||||
redirectURL, err := util.GetLocationURL(client, ctx.MatchedContentURL, "")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create request: %w", err)
|
||||
return nil, fmt.Errorf("failed to get url location: %w", err)
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to send request: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
return &models.ExtractorResponse{
|
||||
URL: resp.Request.URL.String(),
|
||||
URL: redirectURL,
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
|
|
|
@ -46,8 +46,9 @@ var ShortExtractor = &models.Extractor{
|
|||
IsRedirect: true,
|
||||
|
||||
Run: func(ctx *models.DownloadContext) (*models.ExtractorResponse, error) {
|
||||
client := util.GetHTTPClient(ctx.Extractor.CodeName)
|
||||
shortURL := fmt.Sprintf(shortenerAPIFormat, ctx.MatchedContentID)
|
||||
location, err := util.GetLocationURL(shortURL, "")
|
||||
location, err := util.GetLocationURL(client, shortURL, "")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get real url: %w", err)
|
||||
}
|
||||
|
|
|
@ -46,12 +46,13 @@ var VMExtractor = &models.Extractor{
|
|||
IsRedirect: true,
|
||||
|
||||
Run: func(ctx *models.DownloadContext) (*models.ExtractorResponse, error) {
|
||||
location, err := util.GetLocationURL(ctx.MatchedContentURL, "")
|
||||
client := util.GetHTTPClient(ctx.Extractor.CodeName)
|
||||
redirectURL, err := util.GetLocationURL(client, ctx.MatchedContentURL, "")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get url location: %w", err)
|
||||
}
|
||||
return &models.ExtractorResponse{
|
||||
URL: location,
|
||||
URL: redirectURL,
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue