instagram: fixes share urls

This commit is contained in:
stefanodvx 2025-04-21 22:30:52 +02:00
parent 34219a848e
commit 3e307658fa
5 changed files with 33 additions and 9 deletions

View file

@ -74,7 +74,11 @@ var ShareURLExtractor = &models.Extractor{
Run: func(ctx *models.DownloadContext) (*models.ExtractorResponse, error) {
client := util.GetHTTPClient(ctx.Extractor.CodeName)
redirectURL, err := util.GetLocationURL(client, ctx.MatchedContentURL, "")
redirectURL, err := util.GetLocationURL(
client,
ctx.MatchedContentURL,
igHeaders,
)
if err != nil {
return nil, fmt.Errorf("failed to get url location: %w", err)
}

View file

@ -18,8 +18,26 @@ import (
"github.com/bytedance/sonic"
)
var captionPattern = regexp.MustCompile(
`(?s)<meta property="og:title" content=".*?: &quot;(.*?)&quot;"`,
var (
captionPattern = regexp.MustCompile(
`(?s)<meta property="og:title" content=".*?: &quot;(.*?)&quot;"`)
igHeaders = map[string]string{
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Accept-Language": "en-GB,en;q=0.9",
"Cache-Control": "max-age=0",
"Dnt": "1",
"Priority": "u=0, i",
"Sec-Ch-Ua": `Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99`,
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": "macOS",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "none",
"Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1",
"User-Agent": util.ChromeUA,
}
)
func BuildSignedPayload(contentURL string) (io.Reader, error) {

View file

@ -48,7 +48,7 @@ var ShortExtractor = &models.Extractor{
Run: func(ctx *models.DownloadContext) (*models.ExtractorResponse, error) {
client := util.GetHTTPClient(ctx.Extractor.CodeName)
shortURL := fmt.Sprintf(shortenerAPIFormat, ctx.MatchedContentID)
location, err := util.GetLocationURL(client, shortURL, "")
location, err := util.GetLocationURL(client, shortURL, nil)
if err != nil {
return nil, fmt.Errorf("failed to get real url: %w", err)
}

View file

@ -47,7 +47,7 @@ var VMExtractor = &models.Extractor{
Run: func(ctx *models.DownloadContext) (*models.ExtractorResponse, error) {
client := util.GetHTTPClient(ctx.Extractor.CodeName)
redirectURL, err := util.GetLocationURL(client, ctx.MatchedContentURL, "")
redirectURL, err := util.GetLocationURL(client, ctx.MatchedContentURL, nil)
if err != nil {
return nil, fmt.Errorf("failed to get url location: %w", err)
}