Login Register


What's wrong with this JS code? filter_list
Author
Message
What's wrong with this JS code? #1
So I was making simple javascript code for auto-following on Instagram: follows 25 users, then waits for 10 minutes and does it again.

Yet I get this exception (when pasting it into console on Instagram website): Uncaught SyntaxError: await is only valid in async function on line 11

Code:
start: function sleep(ms) {  return new Promise(resolve => setTimeout(resolve, ms)); } var items = document.querySelectorAll("._0mzm-"); for (var i = 0; i < 25; i++) {    if (items[i].innerText === "Follow") { items[i].click();    } } await sleep(601500); goto start;

I believe it's something up to waiting function (obviously), but I'm not sure how to fix it. Any ideas?
(This post was last modified: 01-07-2019, 09:32 PM by Cyb3rNuX.)
Profitable dating, shopping, VPN, finance checkers - Click here to visit!

Website: kidux.net, Telegram group:
t.me/kiduxcheckers

Reply

RE: What's wrong with this JS code? #2
If I'm not mistaken, the await can only work within an async function, hence the syntax error.

Try wrapping the await within the async function.
[Image: AD83g1A.png]

Reply

RE: What's wrong with this JS code? #3
Did you know God kills innocent kittens when you write code like that? Like... brutally murders them and laughs.

I did this to save lives:

Code:
setInterval(() => { let items = document.querySelectorAll('._0mzm-') let bound = items.length >= 25 ? 25 : items.length for (var i = 0; i < bound; i++) { if (items[i].innerText === 'Follow') { items[i].click() } } }, 601500)

You may also want to experiment with variable sleep times along with spreading requests over proxies. DM me if you have questions.
(This post was last modified: 01-08-2019, 09:08 PM by Hoss.)

[+] 3 users Like Hoss's post
Reply

RE: What's wrong with this JS code? #4
(01-08-2019, 06:18 AM)mothered Wrote: If I'm not mistaken, the await can only work within an async function, hence the syntax error.

Try wrapping the await within the async function.

I guess that's what return exception was saying, but I didn't understand any of it.

(01-08-2019, 08:09 AM)Hoss Wrote: Did you know God kills innocent kittens when you write code like that? Like... brutally murders them and laughs.

I did this to save lives:

Code:
setInterval(() => { let items = document.querySelectorAll('._0mzm-') let bound = items.length >= 25 ? 25 : items.length for (var i = 0; i < bound; i++) { if (items[i].innerText === 'Follow') { items[i].click() } } }, 601500)

You may also want to experiment with variable sleep times along with spreading requests over proxies. DM me if you have questions.

Seems to work like a charm, thank you for this Smile
Profitable dating, shopping, VPN, finance checkers - Click here to visit!

Website: kidux.net, Telegram group:
t.me/kiduxcheckers

Reply

RE: What's wrong with this JS code? #5
I've never tried working with Instagram's website before but I would assume this would keep clicking the same 25, unless you have another part of the script you didn't post.

Reply

RE: What's wrong with this JS code? #6
(01-09-2019, 04:18 AM)Hoss Wrote: I've never tried working with Instagram's website before but I would assume this would keep clicking the same 25, unless you have another part of the script you didn't post.

I had it running for quite some time now and looks like it runs the code only once, instead of repeating it every n milliseconds.

Or maybe it's clicking the same 25 as you said, but I need it to click on new "Follow" buttons. Any idea?
Profitable dating, shopping, VPN, finance checkers - Click here to visit!

Website: kidux.net, Telegram group:
t.me/kiduxcheckers

Reply

RE: What's wrong with this JS code? #7
(01-09-2019, 05:15 AM)Cyb3rNuX Wrote:
(01-09-2019, 04:18 AM)Hoss Wrote: I've never tried working with Instagram's website before but I would assume this would keep clicking the same 25, unless you have another part of the script you didn't post.

I had it running for quite some time now and looks like it runs the code only once, instead of repeating it every n milliseconds.

Or maybe it's clicking the same 25 as you said, but I need it to click on new "Follow" buttons. Any idea?

How many results populate the page on which you're running the script?

Reply

RE: What's wrong with this JS code? #8
If you are looking to make this into a business I can write you a much more efficient and effective headless application you can throw up on a VPS. PM me if you're interested.

Reply

RE: What's wrong with this JS code? #9
(01-09-2019, 05:42 AM)Hoss Wrote: How many results populate the page on which you're running the script?

Not sure what do you mean by results, but before I inject the script, I open "following" window on random account, which is showing list of other random accounts with "follow" button (the one that script is clicking on).

Script is supposed to click X number of those buttons, then wait X time and loop, but do NOT click on same follow buttons (e.g re-follow/unfollow same accounts from previous loop), but to follow new ones (e.g every 15 minutes).

Hope that's what you asked Smile

(01-09-2019, 06:31 AM)Hoss Wrote: If you are looking to make this into a business I can write you a much more efficient and effective headless application you can throw up on a VPS. PM me if you're interested.

Thank you but I just want to "advertise" my hobby IG account, I'm not interested in something serious if you meant that, I just want to boost my account a little bit, but thanks again.
Profitable dating, shopping, VPN, finance checkers - Click here to visit!

Website: kidux.net, Telegram group:
t.me/kiduxcheckers

Reply







Users browsing this thread: