Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Sep 18, 2024
1 parent 21cd0c0 commit a650171
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions handlers/embed.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package handlers

import (
"fmt"
scraper "instafix/handlers/scraper"
"instafix/utils"
"instafix/views"
Expand Down Expand Up @@ -69,13 +70,14 @@ func Embed(w http.ResponseWriter, r *http.Request) {
// If User-Agent is not bot, redirect to Instagram
viewsData.Title = "InstaFix"
viewsData.URL = "https://instagram.com" + strings.Replace(r.URL.RequestURI(), "/"+mediaNumParams, "", 1)
if !utils.IsBot(r.Header.Get("User-Agent")) {
http.Redirect(w, r, viewsData.URL, http.StatusFound)
return
}
// if !utils.IsBot(r.Header.Get("User-Agent")) {
// http.Redirect(w, r, viewsData.URL, http.StatusFound)
// return
// }

item, err := scraper.GetData(postID)
if err != nil || len(item.Medias) == 0 {
fmt.Println(err)
http.Redirect(w, r, viewsData.URL, http.StatusFound)
return
}
Expand Down

0 comments on commit a650171

Please sign in to comment.