diff --git a/AutoLikerCefSharpWpf/Assets/autotag_injection.js b/AutoLikerCefSharpWpf/Assets/autotag_injection.js
index 7d4228c..1dad5e3 100644
--- a/AutoLikerCefSharpWpf/Assets/autotag_injection.js
+++ b/AutoLikerCefSharpWpf/Assets/autotag_injection.js
@@ -43,12 +43,13 @@ alObject.prototype.initializeSettings = function(tag, likesMin, likesMax, delayM
}
}
-alObject.prototype.instagramStartClickProcess = function(retry=true) {
+alObject.prototype.instagramStartClickProcess = function(retry=0) {
let thisObj = this;
thisObj._postItems = [];
console.log('*** instagramStartClickProcess ***');
- window.scrollTo(0,0);
- thisObj.runDelay(10000, () => {
+ window.scrollTo(0, 0);
+ thisObj.log(' - wait 20s for page to load...');
+ thisObj.runDelay(20000, () => {
thisObj.log((new Date()).toLocaleString() + ': Starting click process ..');
let top_posts = jQuery('h2').eq(0);
let most_recent = jQuery('h2').eq(1);
@@ -61,10 +62,10 @@ alObject.prototype.instagramStartClickProcess = function(retry=true) {
if (jump_to_section == null || jump_to_section == 0) {
thisObj.log('ERROR: couldn\'t find most recent or top posts sections!');
- if (retry) {
- thisObj.log(' - retrying after 60 seconds (to give IG time to load).');
- thisObj.runDelay(60000, () => {
- thisObj.instagramStartClickProcess(false);
+ if (retry<2) {
+ thisObj.log(' - Retry #' + (retry+1) + ': retrying after 30 seconds (to give IG time to load).');
+ thisObj.runDelay(30000, () => {
+ thisObj.instagramStartClickProcess(retry++);
});
} else {
thisObj.runDelay(1000, () => {
@@ -121,7 +122,7 @@ alObject.prototype.instagramClickPost = function(img, x, y) {
});
}
-alObject.prototype.instagramLoopOverPostsClick = function(index) {
+alObject.prototype.instagramLoopOverPostsClick = function (index) {
let thisObj = this;
// initial index
if (!index) {
@@ -130,21 +131,34 @@ alObject.prototype.instagramLoopOverPostsClick = function(index) {
thisObj.log("Like post; " + index + " of " + thisObj._maxLikes);
// like button
//let likeBtn = jQuery('body').find('span._aamw button._abl-').eq(0); // Update: 2022-06-11
- let likeBtn = jQuery('body').find('span._aamw span:has(svg)').eq(0); // Update: 2023-09-12
+ //let likeBtn = jQuery('body').find('span._aamw span:has(svg)').eq(0); // Update: 2023-09-12
+ //let likeBtn = document.querySelectorAll("html svg[aria-label='Like'],html svg[aria-label='Unlike']"); // Update: 2024-02-05 (can't use because rest requires jQuery)
+ let likeBtn = jQuery('body').find('svg[aria-label="Like"], svg[aria-label="Unlike"]').eq(0); // Update (2024-02-05)
+
console.log('likeBtn:');
console.log(likeBtn);
// next button
//let nextBtn = jQuery('a.coreSpriteRightPaginationArrow').eq(0);
//let nextBtn = jQuery('div.l8mY4 button.wpO6b');
- let nextBtn = jQuery('div._aaqg button._abl-');
+ //let nextBtn = jQuery('div._aaqg button._abl-');
+ let nextBtn = jQuery('body').find("svg[aria-label='Next'], svg[aria-label='Navigate to previous item']").eq(0); // Update (2024-02-05)
console.log('nextBtn:');
console.log(nextBtn);
// check if like button exists, if not restart
- if (likeBtn.length == 0) {
- thisObj.log(' - Could not find the "Like" button :(');
+ if (likeBtn.length > 0) {
+ console.log(' - Found "like" button object');
+ likeBtn = likeBtn.parent();
if (nextBtn.length > 0) {
- thisObj.instagramClickNextButton(nextBtn, index);
+ nextBtn = nextBtn.parent();
} else {
+ nextBtn = null;
+ }
+ } else {
+ thisObj.log(' - Could not find the "Like" button');
+ if (nextBtn.length > 0) {
+ thisObj.instagramClickNextButton(nextBtn.parent(), index);
+ } else {
+ thisObj.log(' - Could not find the "Next" button');
thisObj.restartProcess();
}
}
@@ -198,7 +212,7 @@ alObject.prototype.instagramLoopOverPostsClick = function(index) {
alObject.prototype.instagramClickNextButton = function(nextBtn, i) {
let thisObj = this;
- if (i < thisObj._maxLikes) {
+ if (i < thisObj._maxLikes && nextBtn) {
thisObj.log(" - Waiting before clicking on next button ..");
let nextBtnOffset = nextBtn.offset();
console.log(nextBtnOffset);
@@ -217,7 +231,11 @@ alObject.prototype.instagramClickNextButton = function(nextBtn, i) {
});
});
} else {
- thisObj.log(" - Reached end of list of posts, restarting process ..");
+ if (!nextBtn) {
+ thisObj.log(" - Couldn't find Next button, restarting process ..");
+ } else {
+ thisObj.log(" - Reached end of list of posts, restarting process ..");
+ }
thisObj.runDelay(3000, () => {
thisObj.restartProcess();
});
diff --git a/AutoLikerCefSharpWpf/Assets/autotag_injection_min.js b/AutoLikerCefSharpWpf/Assets/autotag_injection_min.js
index 99283d1..a635080 100644
--- a/AutoLikerCefSharpWpf/Assets/autotag_injection_min.js
+++ b/AutoLikerCefSharpWpf/Assets/autotag_injection_min.js
@@ -1 +1 @@
-function alObject() { this._tag = "", this._posts = {}, this._maxLikes = 3, this._likesMin = 5, this._likesMax = 10, this._delayRestart = 15, this._delayRestartMin = 15, this._delayRestartMax = 30, this._delayPerLikeMin = 5, this._delayPerLikeMax = 10, this._endCursor = "", this._failedRetriesMax = 2, this._failedRetries = 0, this._instagramBaseUrl = "https://www.instagram.com", this._postItems = [], this._scrollOffset = null } alObject.prototype.initializeSettings = function (t, e, o, s, l, n, i) { if (this._tag = t, this._likesMin = e, this._likesMax = o, this._delayPerLikeMin = s, this._delayPerLikeMax = l, this._delayRestartMin = n, this._delayRestartMax = i, console.log("tag:" + t + " | likesMin:" + e + " | likesMax:" + o + " | delayMin: " + s + " | delayMax: " + l + " | delayRestartMin: " + n + " | delayRestartMax: " + i), this._maxLikes = this.getRandomInt(this._likesMin, this._likesMax), this._delayRestart = this.getRandomInt(this._delayRestartMin, this._delayRestartMax), console.log("_maxLikes: " + this._maxLikes), console.log("_delayRestart (min): " + this._delayRestart), this._tag.includes(",")) { let t = this._tag.split(","); console.log(t), console.log("tags length: " + t.length); i = this.getRandomInt(0, t.length - 1), i = t[i].trim(); console.log("picked tag: " + i), this._tag = i } }, alObject.prototype.instagramStartClickProcess = function (s = !0) { var r = this; r._postItems = [], console.log("*** instagramStartClickProcess ***"), window.scrollTo(0, 0), r.runDelay(1e4, () => { r.log((new Date).toLocaleString() + ": Starting click process .."); var t = jQuery("h2").eq(0), e = jQuery("h2").eq(1); let o = null; if (0 < e.length ? o = e : 0 == e.length && 0 < t.length && (o = t), null == o || 0 == o) r.log("ERROR: couldn't find most recent or top posts sections!"), s ? (r.log(" - retrying after 60 seconds (to give IG time to load)."), r.runDelay(6e4, () => { r.instagramStartClickProcess(!1) })) : r.runDelay(1e3, () => { r.restartProcess() }); else { let i = o.next(); r.log("Scroll to list .."), jQuery("html, body").animate({ scrollTop: i.offset().top }, 500); var t = i.offset().left, a = i.offset().top; r._scrollOffset = i.offset(), console.log("parentX: " + t + " ; parentY: " + a), r.runDelay(2e3, () => { let t = i.children("div").eq(0), e = t.find("a"); e.each(function (t) { r._postItems.push(jQuery(this).attr("href")) }), console.log("items:"), console.log(r._postItems), r.log("Found posts: " + r._postItems.length); let o = jQuery('a[href="' + r._postItems[0] + '"]'); console.log(o); let s = o.find("img").eq(0); var l, n; console.log(s), console.log(s.attr("src")), s && (console.log("imgX: " + s.offset().left + " ; imgY: " + s.offset().top), l = parseInt(s.offset().left) + 30, n = parseInt(a - s.offset().top) + 60, console.log("clickX: " + l + " ; clickY: " + n), r.log("Will like this many posts: " + r._maxLikes), r.instagramClickPost(s, l, n)) }) } }) }, alObject.prototype.instagramClickPost = function (t, e, o) { var s = this; s.log("Click on initial post .."), boundAsync.singleLeftClick(e, o).then(t => { console.log("Left Click"), s.runDelay(8e3, () => { s.instagramLoopOverPostsClick() }) }) }, alObject.prototype.instagramLoopOverPostsClick = function (e) { var o = this; e = e || 1, o.log("Like post; " + e + " of " + o._maxLikes); let t = jQuery("body").find("span._aamw span:has(svg)").eq(0); console.log("likeBtn:"), console.log(t); var s = jQuery("div._aaqg button._abl-"); console.log("nextBtn:"), console.log(s), 0 == t.length && (o.log(' - Could not find the "Like" button :('), 0 < s.length ? o.instagramClickNextButton(s, e) : o.restartProcess()); var l = t.offset(), n = parseInt(l.top - jQuery(window).scrollTop()), i = parseInt(l.left - jQuery(window).scrollLeft()); console.log("likeBtn = clickX: " + i + " ; clickY: " + n); let a = t.find("svg").eq(0); var r, c = a.attr("aria-label"); console.log("Like Text: " + c), "Like" === c ? (l = 1e3 * (r = o.getRandomInt(o._delayPerLikeMin, o._delayPerLikeMax)), o.log(" - not liked yet; delay before clicking like = " + r + " sec"), o.runDelay(l, () => { o.log(" - initiating clicking Like button .."), boundAsync.singleLeftClick(i + 10, n + 10).then(t => { o.log(" - clicked Like button .. wait to confirm .."), o.runDelay(4e3, () => { c = jQuery("body").find("span._aamw svg").eq(0).attr("aria-label"), console.log("Like Text: " + c), "Like" !== c ? (o.log(" - Successfully liked!"), o.instagramClickNextButton(s, e)) : (o.log(" - POST NOT LIKED! BLOCKED??"), o.log("*** STOPPING ***"), o.restartProcess()) }) }, t => { o.log(" - Error liking! Reason = " + t), o.instagramClickNextButton(s, e) }) })) : (o.log(" - already liked this post!"), o.instagramClickNextButton(s, e - 1)) }, alObject.prototype.instagramClickNextButton = function (t, e) { var o, s, l = this; e < l._maxLikes ? (l.log(" - Waiting before clicking on next button .."), t = t.offset(), console.log(t), o = parseInt(t.top - jQuery(window).scrollTop()), s = parseInt(t.left - jQuery(window).scrollLeft()), console.log("nextBtn = nextX: " + s + " ; nextY: " + o), l.runDelay(3e3, () => { boundAsync.singleLeftClick(s + 10, o + 10).then(t => { l.log(" - Successfully went to the next post! Wait 5 sec .."), l.runDelay(5e3, () => { var t = e + 1; l.instagramLoopOverPostsClick(t) }) }, t => { l.log(" - Error going to the next post! Reason = " + t) }) })) : (l.log(" - Reached end of list of posts, restarting process .."), l.runDelay(3e3, () => { l.restartProcess() })) }, alObject.prototype.restartProcess = function () { var o = this; if (console.log("*** restartProcess ***"), boundAsync) { let t; t = o._delayRestart || 15; var s = 6e4 * t; let e = new Date; var l = new Date(e.getTime() + s); o.log(e.toLocaleString() + ": RESTARTING in (min): " + t), o.log(" - Reloading at: " + l.toLocaleString()), o.runDelay(s, () => { boundAsync.restartProcess().then(t => { console.log("reloading ..") }) }) } }, alObject.prototype.runDelay = function (t, e) { setTimeout(e, t) }, alObject.prototype.log = function (t) { console.log(t), boundAsync && boundAsync.logMessage(t).then(t => { }, t => { console.error(t) }) }, alObject.prototype.getRandomInt = function (t, e) { return Math.floor(Math.random() * (e - t + 1)) + t };
\ No newline at end of file
+function alObject() { this._tag = "", this._posts = {}, this._maxLikes = 3, this._likesMin = 5, this._likesMax = 10, this._delayRestart = 15, this._delayRestartMin = 15, this._delayRestartMax = 30, this._delayPerLikeMin = 5, this._delayPerLikeMax = 10, this._endCursor = "", this._failedRetriesMax = 2, this._failedRetries = 0, this._instagramBaseUrl = "https://www.instagram.com", this._postItems = [], this._scrollOffset = null } alObject.prototype.initializeSettings = function (t, e, o, l, s, n, i) { if (this._tag = t, this._likesMin = e, this._likesMax = o, this._delayPerLikeMin = l, this._delayPerLikeMax = s, this._delayRestartMin = n, this._delayRestartMax = i, console.log("tag:" + t + " | likesMin:" + e + " | likesMax:" + o + " | delayMin: " + l + " | delayMax: " + s + " | delayRestartMin: " + n + " | delayRestartMax: " + i), this._maxLikes = this.getRandomInt(this._likesMin, this._likesMax), this._delayRestart = this.getRandomInt(this._delayRestartMin, this._delayRestartMax), console.log("_maxLikes: " + this._maxLikes), console.log("_delayRestart (min): " + this._delayRestart), this._tag.includes(",")) { let t = this._tag.split(","); console.log(t), console.log("tags length: " + t.length); i = this.getRandomInt(0, t.length - 1), i = t[i].trim(); console.log("picked tag: " + i), this._tag = i } }, alObject.prototype.instagramStartClickProcess = function (l = 0) { var r = this; r._postItems = [], console.log("*** instagramStartClickProcess ***"), window.scrollTo(0, 0), r.log(" - wait 20s for page to load..."), r.runDelay(2e4, () => { r.log((new Date).toLocaleString() + ": Starting click process .."); var t = jQuery("h2").eq(0), e = jQuery("h2").eq(1); let o = null; if (0 < e.length ? o = e : 0 == e.length && 0 < t.length && (o = t), null == o || 0 == o) r.log("ERROR: couldn't find most recent or top posts sections!"), l < 2 ? (r.log(" - Retry #" + (l + 1) + ": retrying after 30 seconds (to give IG time to load)."), r.runDelay(3e4, () => { r.instagramStartClickProcess(l++) })) : r.runDelay(1e3, () => { r.restartProcess() }); else { let i = o.next(); r.log("Scroll to list .."), jQuery("html, body").animate({ scrollTop: i.offset().top }, 500); var t = i.offset().left, a = i.offset().top; r._scrollOffset = i.offset(), console.log("parentX: " + t + " ; parentY: " + a), r.runDelay(2e3, () => { let t = i.children("div").eq(0), e = t.find("a"); e.each(function (t) { r._postItems.push(jQuery(this).attr("href")) }), console.log("items:"), console.log(r._postItems), r.log("Found posts: " + r._postItems.length); let o = jQuery('a[href="' + r._postItems[0] + '"]'); console.log(o); let l = o.find("img").eq(0); var s, n; console.log(l), console.log(l.attr("src")), l && (console.log("imgX: " + l.offset().left + " ; imgY: " + l.offset().top), s = parseInt(l.offset().left) + 30, n = parseInt(a - l.offset().top) + 60, console.log("clickX: " + s + " ; clickY: " + n), r.log("Will like this many posts: " + r._maxLikes), r.instagramClickPost(l, s, n)) }) } }) }, alObject.prototype.instagramClickPost = function (t, e, o) { var l = this; l.log("Click on initial post .."), boundAsync.singleLeftClick(e, o).then(t => { console.log("Left Click"), l.runDelay(8e3, () => { l.instagramLoopOverPostsClick() }) }) }, alObject.prototype.instagramLoopOverPostsClick = function (e) { var o = this; e = e || 1, o.log("Like post; " + e + " of " + o._maxLikes); let t = jQuery("body").find('svg[aria-label="Like"], svg[aria-label="Unlike"]').eq(0); console.log("likeBtn:"), console.log(t); let l = jQuery("body").find("svg[aria-label='Next'], svg[aria-label='Navigate to previous item']").eq(0); console.log("nextBtn:"), console.log(l), 0 < t.length ? (console.log(' - Found "like" button object'), t = t.parent(), l = 0 < l.length ? l.parent() : null) : (o.log(' - Could not find the "Like" button'), 0 < l.length ? o.instagramClickNextButton(l.parent(), e) : (o.log(' - Could not find the "Next" button'), o.restartProcess())); var s = t.offset(), n = parseInt(s.top - jQuery(window).scrollTop()), i = parseInt(s.left - jQuery(window).scrollLeft()); console.log("likeBtn = clickX: " + i + " ; clickY: " + n); let a = t.find("svg").eq(0); var r, c = a.attr("aria-label"); console.log("Like Text: " + c), "Like" === c ? (s = 1e3 * (r = o.getRandomInt(o._delayPerLikeMin, o._delayPerLikeMax)), o.log(" - not liked yet; delay before clicking like = " + r + " sec"), o.runDelay(s, () => { o.log(" - initiating clicking Like button .."), boundAsync.singleLeftClick(i + 10, n + 10).then(t => { o.log(" - clicked Like button .. wait to confirm .."), o.runDelay(4e3, () => { c = jQuery("body").find("span._aamw svg").eq(0).attr("aria-label"), console.log("Like Text: " + c), "Like" !== c ? (o.log(" - Successfully liked!"), o.instagramClickNextButton(l, e)) : (o.log(" - POST NOT LIKED! BLOCKED??"), o.log("*** STOPPING ***"), o.restartProcess()) }) }, t => { o.log(" - Error liking! Reason = " + t), o.instagramClickNextButton(l, e) }) })) : (o.log(" - already liked this post!"), o.instagramClickNextButton(l, e - 1)) }, alObject.prototype.instagramClickNextButton = function (t, e) { var o, l, s, n = this; e < n._maxLikes && t ? (n.log(" - Waiting before clicking on next button .."), o = t.offset(), console.log(o), l = parseInt(o.top - jQuery(window).scrollTop()), s = parseInt(o.left - jQuery(window).scrollLeft()), console.log("nextBtn = nextX: " + s + " ; nextY: " + l), n.runDelay(3e3, () => { boundAsync.singleLeftClick(s + 10, l + 10).then(t => { n.log(" - Successfully went to the next post! Wait 5 sec .."), n.runDelay(5e3, () => { var t = e + 1; n.instagramLoopOverPostsClick(t) }) }, t => { n.log(" - Error going to the next post! Reason = " + t) }) })) : (t ? n.log(" - Reached end of list of posts, restarting process ..") : n.log(" - Couldn't find Next button, restarting process .."), n.runDelay(3e3, () => { n.restartProcess() })) }, alObject.prototype.restartProcess = function () { var o = this; if (console.log("*** restartProcess ***"), boundAsync) { let t; t = o._delayRestart || 15; var l = 6e4 * t; let e = new Date; var s = new Date(e.getTime() + l); o.log(e.toLocaleString() + ": RESTARTING in (min): " + t), o.log(" - Reloading at: " + s.toLocaleString()), o.runDelay(l, () => { boundAsync.restartProcess().then(t => { console.log("reloading ..") }) }) } }, alObject.prototype.runDelay = function (t, e) { setTimeout(e, t) }, alObject.prototype.log = function (t) { console.log(t), boundAsync && boundAsync.logMessage(t).then(t => { }, t => { console.error(t) }) }, alObject.prototype.getRandomInt = function (t, e) { return Math.floor(Math.random() * (e - t + 1)) + t };
\ No newline at end of file
diff --git a/AutoLikerCefSharpWpf/AutoLikerCefSharpWpf.csproj b/AutoLikerCefSharpWpf/AutoLikerCefSharpWpf.csproj
index c3aaf61..eacbaaa 100644
--- a/AutoLikerCefSharpWpf/AutoLikerCefSharpWpf.csproj
+++ b/AutoLikerCefSharpWpf/AutoLikerCefSharpWpf.csproj
@@ -1,8 +1,8 @@
-
-
-
+
+
+
Debug
@@ -83,14 +83,14 @@
Resources\autoliker-512.ico
-
- ..\packages\CefSharp.Common.116.0.190\lib\net462\CefSharp.dll
+
+ ..\packages\CefSharp.Common.120.2.70\lib\net462\CefSharp.dll
-
- ..\packages\CefSharp.Common.116.0.190\lib\net462\CefSharp.Core.dll
+
+ ..\packages\CefSharp.Common.120.2.70\lib\net462\CefSharp.Core.dll
-
- ..\packages\CefSharp.Wpf.116.0.190\lib\net462\CefSharp.Wpf.dll
+
+ ..\packages\CefSharp.Wpf.120.2.70\lib\net462\CefSharp.Wpf.dll
..\packages\MaterialDesignColors.2.1.4\lib\net462\MaterialDesignColors.dll
@@ -99,7 +99,7 @@
..\packages\MaterialDesignThemes.4.9.0\lib\net462\MaterialDesignThemes.Wpf.dll
- ..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.39\lib\net45\Microsoft.Xaml.Behaviors.dll
+ ..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.77\lib\net462\Microsoft.Xaml.Behaviors.dll
@@ -196,12 +196,12 @@
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
+
+
+
+
-
+
\ No newline at end of file
diff --git a/AutoLikerCefSharpWpf/MainWindow.xaml.cs b/AutoLikerCefSharpWpf/MainWindow.xaml.cs
index 7f054b2..32ad0e9 100644
--- a/AutoLikerCefSharpWpf/MainWindow.xaml.cs
+++ b/AutoLikerCefSharpWpf/MainWindow.xaml.cs
@@ -21,7 +21,7 @@ namespace AutoLikerCefSharpWpf
InitializeComponent();
// version
- this.AutoLikerVersion = "v2.0.3-20230914";
+ this.AutoLikerVersion = "v2.0.6-20240205";
this.DataContext = this;
// manage settings in UI
this._alsm = new AutoLikerSettingsManager(this);
diff --git a/AutoLikerCefSharpWpf/packages.config b/AutoLikerCefSharpWpf/packages.config
index 4b014d3..e8f0fa2 100644
--- a/AutoLikerCefSharpWpf/packages.config
+++ b/AutoLikerCefSharpWpf/packages.config
@@ -1,10 +1,10 @@
-
-
-
-
+
+
+
+
-
+
\ No newline at end of file