Fix for DOM changes + cache folder #4
@ -17,7 +17,7 @@ namespace AutoLikerCefSharpWpf
|
||||
var settings = new CefSettings()
|
||||
{
|
||||
//By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
|
||||
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache")
|
||||
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "AutoLiker2\\Cache")
|
||||
};
|
||||
|
||||
//Example of setting a command line argument
|
||||
|
||||
@ -55,8 +55,10 @@ alObject.prototype.instagramStartClickProcess = function(retry=0) {
|
||||
let most_recent = jQuery('h2').eq(1);
|
||||
let jump_to_section = null;
|
||||
if (most_recent.length > 0) {
|
||||
thisObj.log(' - Using "Most Recent" list');
|
||||
jump_to_section = most_recent;
|
||||
} else if (most_recent.length == 0 && top_posts.length > 0) {
|
||||
thisObj.log(' - Using "Top Posts" list');
|
||||
jump_to_section = top_posts;
|
||||
}
|
||||
|
||||
@ -74,38 +76,49 @@ alObject.prototype.instagramStartClickProcess = function(retry=0) {
|
||||
}
|
||||
|
||||
} else {
|
||||
let mr_div = jump_to_section.next();
|
||||
thisObj.log('Scroll to list ..');
|
||||
jQuery('html, body').animate({ scrollTop: mr_div.offset().top }, 500);
|
||||
let parentX = mr_div.offset().left;
|
||||
let parentY = mr_div.offset().top;
|
||||
thisObj._scrollOffset = mr_div.offset();
|
||||
console.log('parentX: ' + parentX + ' ; parentY: ' + parentY);
|
||||
thisObj.runDelay(2000, () => {
|
||||
let child01 = mr_div.children('div').eq(0);
|
||||
let postLinks = child01.find('a');
|
||||
postLinks.each( function(i) {
|
||||
thisObj._postItems.push(jQuery(this).attr('href'));
|
||||
let divJumpTo = jump_to_section.parent(); // get parent <div> of <h2> element
|
||||
if (divJumpTo.siblings().length < 1) {
|
||||
divJumpTo = jump_to_section.parent().parent();
|
||||
}
|
||||
if (divJumpTo.siblings().length < 1) {
|
||||
thisObj.log('ERROR: couldn\'t find list of posts!');
|
||||
thisObj.runDelay(1000, () => {
|
||||
thisObj.restartProcess();
|
||||
});
|
||||
console.log('items:');
|
||||
console.log(thisObj._postItems);
|
||||
thisObj.log('Found posts: ' + thisObj._postItems.length);
|
||||
// get first post
|
||||
let element01 = jQuery('a[href="' + thisObj._postItems[0] + '"]');
|
||||
console.log(element01);
|
||||
let element02 = element01.find('img').eq(0);
|
||||
console.log(element02);
|
||||
console.log(element02.attr('src'));
|
||||
if (element02) {
|
||||
console.log('imgX: ' + element02.offset().left + ' ; imgY: ' + element02.offset().top);
|
||||
//let clickX = parseInt(parentX - element02.offset().left) + 1;
|
||||
let clickX = parseInt(element02.offset().left) + 30;
|
||||
let clickY = parseInt(parentY - element02.offset().top) + 60;
|
||||
console.log('clickX: ' + clickX + ' ; clickY: ' + clickY);
|
||||
thisObj.log('Will like this many posts: ' + thisObj._maxLikes);
|
||||
thisObj.instagramClickPost(element02, clickX, clickY);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
divJumpTo = divJumpTo.next(); // go to the next sibling (posts <div>)
|
||||
thisObj.log('Scroll to list ..');
|
||||
jQuery('html, body').animate({ scrollTop: divJumpTo.offset().top }, 500);
|
||||
let parentX = divJumpTo.offset().left;
|
||||
let parentY = divJumpTo.offset().top;
|
||||
thisObj._scrollOffset = divJumpTo.offset();
|
||||
console.log('parentX: ' + parentX + ' ; parentY: ' + parentY);
|
||||
thisObj.runDelay(2000, () => {
|
||||
let child01 = divJumpTo.children('div').eq(0);
|
||||
let postLinks = child01.find('a');
|
||||
postLinks.each(function (i) {
|
||||
thisObj._postItems.push(jQuery(this).attr('href'));
|
||||
});
|
||||
console.log('items:');
|
||||
console.log(thisObj._postItems);
|
||||
thisObj.log('Found posts: ' + thisObj._postItems.length);
|
||||
// get first post
|
||||
let element01 = jQuery('a[href="' + thisObj._postItems[0] + '"]');
|
||||
console.log(element01);
|
||||
let element02 = element01.find('img').eq(0);
|
||||
console.log(element02);
|
||||
console.log(element02.attr('src'));
|
||||
if (element02) {
|
||||
console.log('imgX: ' + element02.offset().left + ' ; imgY: ' + element02.offset().top);
|
||||
//let clickX = parseInt(parentX - element02.offset().left) + 1;
|
||||
let clickX = parseInt(element02.offset().left) + 30;
|
||||
let clickY = parseInt(parentY - element02.offset().top) + 60;
|
||||
console.log('clickX: ' + clickX + ' ; clickY: ' + clickY);
|
||||
thisObj.log('Will like this many posts: ' + thisObj._maxLikes);
|
||||
thisObj.instagramClickPost(element02, clickX, clickY);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -161,6 +161,7 @@
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.manifest" />
|
||||
<None Include="README.md" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
using CefSharp;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
@ -21,7 +20,7 @@ namespace AutoLikerCefSharpWpf
|
||||
InitializeComponent();
|
||||
|
||||
// version
|
||||
this.AutoLikerVersion = "v2.0.6-20240205";
|
||||
this.AutoLikerVersion = "v2.0.7-20240330";
|
||||
this.DataContext = this;
|
||||
// manage settings in UI
|
||||
this._alsm = new AutoLikerSettingsManager(this);
|
||||
@ -84,7 +83,11 @@ namespace AutoLikerCefSharpWpf
|
||||
args.Frame.ExecuteJavaScriptAsync(jq);
|
||||
|
||||
// Inject AutoLiker class
|
||||
#if DEBUG
|
||||
string aljs = JavaScriptProcessor.ReturnJavaScriptFromFile("autotag_injection.js");
|
||||
#else
|
||||
string aljs = JavaScriptProcessor.ReturnJavaScriptFromFile("autotag_injection_min.js");
|
||||
#endif
|
||||
args.Frame.ExecuteJavaScriptAsync(aljs);
|
||||
|
||||
this.Dispatcher.Invoke(() =>
|
||||
|
||||
6
AutoLikerCefSharpWpf/README.md
Normal file
6
AutoLikerCefSharpWpf/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# Auto Liker CefSharp WPF
|
||||
Automate liking of Instagram posts.
|
||||
|
||||
## Release Notes
|
||||
* v2.0.7-20240330
|
||||
* #3 Fix H2 scrolling issue
|
||||
Loading…
x
Reference in New Issue
Block a user