Sie sind auf Seite 1von 4

// Here You can type your custom JavaScript...

function countposts(){

var posts = document.getElementsByClassName("_8mlbc _vbtk2 _t5r8b");

console.log("There are ",posts.length," posts");

return posts;

function scrolldown(){

x=0;

y=document.body.scrollHeight;

window.scroll(x,y);

function openpost(seconds){

// Q defines SetTimeout Recursion counter

// Function will iterate from 9 -> instagramposts.length

// First 9 posts are top posts, small impact probability

Q=9;

console.log(seconds);

instagramposts=countposts();

function posttime(limit){

setTimeout(function(){

// close button is only available after html element load

// close click is postponed until net setTimeout loop


if(Q>9&&Q<instagramposts.length){

console.log("current element ",Q," of ",instagramposts.length-1," total");

var like = document.getElementsByClassName("_soakw coreSpriteHeartOpen");

like[0].click();

var closebtn = document.getElementsByClassName("_3eajp");

closebtn[0].click();

if(Q==(instagramposts.length-1)){

window.location.href="https://www.instagram.com/explore/tags/photography";

if(Q==9){

instagramposts[Q].click();

posttime(limit);

Q++;

},limit*1000);

posttime(seconds);

// LIKE BUTTON

// var like = document.getElementsByClassName("_soakw coreSpriteHeartOpen");

// like[0].click();
//COMMENT

//var form = document.getElementsByClassName("_7uiwk _qy55y");

//form[0].value="cool shot! thats a nice one";

function open(times,scrollseconds,likeseconds){

// m defines setTimeout recursion counter

m=0;

function cycles(limit,seconds,openlimit){

setTimeout(function(){

if(m<=limit){

console.log(m,"TRUE");

cycles(limit,seconds,openlimit);

m++;

scrolldown();

else{

countposts();

console.log(openlimit);

openpost(openlimit);

},seconds*1000);

//FIRST CLICK MORE POSTS BUTTON


var z = document.getElementsByClassName("_8imhp _glz1g");

z[0].click();

//REPEAT SCROLL DOWN DESIRED TIMES

cycles(times,scrollseconds,likeseconds);

//open(timesScrollDown,SecondsUntilNextScroll)

open(0,3,3);

//var s = document.getElementsByClassName("_8mlbc _vbtk2 _t5r8b")

Das könnte Ihnen auch gefallen