In Prog
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-rod/rod"
|
||||||
)
|
)
|
||||||
|
|
||||||
type InstaRes struct {
|
type InstaRes struct {
|
||||||
@@ -123,13 +125,17 @@ func (r *Runner) GetIntsaEgagement(urls []string) []InstaPost {
|
|||||||
res.URL = "https://www.instagram.com" + url
|
res.URL = "https://www.instagram.com" + url
|
||||||
if res.Timestamp.Before(r.currentTime) {
|
if res.Timestamp.Before(r.currentTime) {
|
||||||
//Hard get the likes
|
//Hard get the likes
|
||||||
if res.Likes == 0 {
|
if res.Likes == 0 && res.Views == 0 {
|
||||||
r.page.MustElementByJS(instagram_liked_by_url).MustClick()
|
element, err := r.page.ElementByJS(&rod.EvalOptions{JS: instagram_liked_by_url})
|
||||||
r.page.MustWaitLoad()
|
if err != nil {
|
||||||
r.Scroll(99999, longTimeOut)
|
fmt.Println("Edge Case Where Likes and Comments are Zero")
|
||||||
likes := r.page.MustEval(instagram_liked_by).Int()
|
} else {
|
||||||
|
element.MustClick()
|
||||||
res.Likes = likes
|
r.page.MustWaitLoad()
|
||||||
|
r.Scroll(99999, longTimeOut)
|
||||||
|
likes := r.page.MustEval(instagram_liked_by).Int()
|
||||||
|
res.Likes = likes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if res.Views != 0 {
|
if res.Views != 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user