Jump to content
UBot Underground

hmmm...tutorials not helping.


Recommended Posts

I expected a learning curve and for sure i am not frustrated, but I am trying do make what I think is a simple bot. That is, just click all the follows on a twitter page. Seems simple right?

 

But none of the tutorials apear to be helping me to figure it out. it's like telling me there is a tool and the tool can cut. Then show me a peice of wire and show the tool cutting it. But there are no tutorials on showing the tool actually used on a real prodject.

 

I am willing to keep plugin away untill it clicks, of course, but I think I need more in depth help.

 

 

Link to post
Share on other sites

Can you please be a little bit more specific? Ppl don't reveal their real projects just like that, so if you have an idea on what to do (and you feel that you can share here to get some hints on what to do) that would be best.

 

When I started I had an issue in getting the lists to work (and yet, I have used lists quite a lot in lower level programming).

Link to post
Share on other sites

Yes, you were. Hahahaha! I read your post too fast. :D

Here it is:
 

 

set user agent("Chrome")
navigate("http://twitter.com", "Wait")
alert("Make sure you are logged and is ready to follow")
pause script
loop(10) {
    type text(<id="page-container">, "\{PGDN\}", "Standard")
    wait(2)
}
wait for browser event("DOM Ready", "")
clear list(%followLinks)
add list to list(%followLinks, $find regular expression($document text, "(?<=<div class=\"user-actions btn-group not-following can-dm  \" data-user-id=\"[0-9]+\" data-screen-name=\")[a-zA-Z0-9]+(?=\" data-name=\".+\" data-protected=\".+\">)"), "Delete", "Global")
set(#i, 0, "Global")
set(#saveURL, $url, "Global")
loop($list total(%followLinks)) {
    navigate("https://twitter.com/{$list item(%followLinks, #i)}", "Wait")
    wait for element(<class="button-text follow-text">, "", "Appear")
    click(<class="button-text follow-text">, "Left Click", "No")
    increment(#i)
    wait(2)
}
navigate("https://twitter.com/followers", "Wait")
alert("Ready! Now you follow {#i} additional Twitter users")

 


This code assumes that you login manually to Twitter and then click on those who are following you. If you want to follow others, you might need to adjust the code. I have only tested it in this situation, but it's an example to get you going with UBot. I hope it helps you.


 

Link to post
Share on other sites

A few comments would probably help you  (I discovered a tiny piece of code that wasn't used, and I added a statmonitor at the very beginning). Here we go:

 

 

ui stat monitor("Following ", "{#i} new users")
comment("Make sure you appear as a Chrome user and this was the state under which you developed your bot (in case it differs between browsers)")
set user agent("Chrome")
navigate("http://twitter.com", "Wait")
alert("Make sure you are logged and is ready to follow")
pause script
comment("This loop is here because the page is loaded automatically in some ajax call. By doing a few PgDn key presses, you will get some more users into your scope")
loop(10) {
    type text(<id="page-container">, "\{PGDN\}", "Standard")
    wait(2)
}
wait for browser event("DOM Ready", "")
comment("Allocate and clean a list that you can use to save the users you are not already following")
clear list(%followLinks)
comment("Scrape the user names of the users that follow you, but that you don't follow (yet)")
comment("There is something called a RegExp here. RegExp is an abbreviation for Regular Expression. This is science by itself, so just Google it. It's very powerful.")
comment("The thing that happens here is that I find the HTML code patterns that are associated with a Twitter user that you don't follow and then I scrape that user's user name")
add list to list(%followLinks, $find regular expression($document text, "(?<=<div class=\"user-actions btn-group not-following can-dm  \" data-user-id=\"[0-9]+\" data-screen-name=\")[a-zA-Z0-9]+(?=\" data-name=\".+\" data-protected=\".+\">)"), "Delete", "Global")
set(#i, 0, "Global")
comment("Hmmm... I just realized that I never used #saveURL :)")
set(#saveURL, $url, "Global")
comment("Loop though the user names your just scraped")
loop($list total(%followLinks)) {
    comment("Navigate to the user's page on the current list position")
    navigate("https://twitter.com/{$list item(%followLinks, #i)}", "Wait")
    comment("Wait for the interesting Follow button to load before you try to click it")
    wait for element(<class="button-text follow-text">, "", "Appear")
    comment("Click the Follow button")
    click(<class="button-text follow-text">, "Left Click", "No")
    comment("Increment the index you use to find the user in your list of scraped users")
    increment(#i)
    comment("Make it look a little bit natural, wait for 2 secs before proceeding")
    wait(2)
}
comment("Pretty pointless navigate, but it's here :)")
navigate("https://twitter.com/followers", "Wait")
comment("Tell you that the process is finalised and how many new users you are following")
alert("Ready! Now you follow {#i} additional Twitter users")

 

I hope it helps!

Link to post
Share on other sites
Yes, you were. Hahahaha! I read your post too fast. :D

 

Here it is:

 

 

set user agent("Chrome")
navigate("http://twitter.com", "Wait")
alert("Make sure you are logged and is ready to follow")
pause script
loop(10) {
    type text(<id="page-container">, "\{PGDN\}", "Standard")
    wait(2)
}
wait for browser event("DOM Ready", "")
clear list(%followLinks)
add list to list(%followLinks, $find regular expression($document text, "(?<=<div class=\"user-actions btn-group not-following can-dm  \" data-user-id=\"[0-9]+\" data-screen-name=\")[a-zA-Z0-9]+(?=\" data-name=\".+\" data-protected=\".+\">)"), "Delete", "Global")
set(#i, 0, "Global")
set(#saveURL, $url, "Global")
loop($list total(%followLinks)) {
    navigate("https://twitter.com/{$list item(%followLinks, #i)}", "Wait")
    wait for element(<class="button-text follow-text">, "", "Appear")
    click(<class="button-text follow-text">, "Left Click", "No")
    increment(#i)
    wait(2)
}
navigate("https://twitter.com/followers", "Wait")
alert("Ready! Now you follow {#i} additional Twitter users")

 

 

This code assumes that you login manually to Twitter and then click on those who are following you. If you want to follow others, you might need to adjust the code. I have only tested it in this situation, but it's an example to get you going with UBot. I hope it helps you.

 

 

So this is not a script that clicks the follow button in someones account?

 

I do not understand what you said. sorry, I am slow.

Link to post
Share on other sites

Yes, it does. You said "...just click all the follows on a twitter page".

 

Since I don't know what page, I made you a bot that requires you to stand on the page where you want to follow all those that you are not following on that page. You just wanted a sample code on how you click on Follow buttons, right!? You are not asking for a complete Twitter bot that does all the work for you, including the login and finding the page you are looking for?

 

So what you need to do is:

 

1) copy my code above

2) paste it into UBot Studio (in Code View)

3) go to Node View

4) run the bot

5) when the alert pop ups, click the OK button

6) login (via the bot's browser) to Twitter

7) click on "Followers" in your Twitter account (using the bot's browser)

8) wait for that page to load

9) continue running the bot by clicking the bot's Run-button

10) check the results

Link to post
Share on other sites
Yes, it does. You said "...just click all the follows on a twitter page".

 

Since I don't know what page, I made you a bot that requires you to stand on the page where you want to follow all those that you are not following on that page. You just wanted a sample code on how you click on Follow buttons, right!? You are not asking for a complete Twitter bot that does all the work for you, including the login and finding the page you are looking for?

 

So what you need to do is:

 

1) copy my code above

2) paste it into UBot Studio (in Code View)

3) go to Node View

4) run the bot

5) when the alert pop ups, click the OK button

6) login (via the bot's browser) to Twitter

7) click on "Followers" in your Twitter account (using the bot's browser)

8) wait for that page to load

9) continue running the bot by clicking the bot's Run-button

10) check the results

 

 

Ok...now THAT makes sense.

 

Only one thing. When you say copy that code, do you mean litterally copy and past that code? Or do you mean look at what you wrote and figure out which modules to put in my bot?

 

Aren't we newbies a pain in the ass?

Link to post
Share on other sites

another thing us newbies do........we figure somthing out by the time you can reply.  I DID copy the code. Thanks.

 

let me play with this.

 

Thank you!

Link to post
Share on other sites

ok.......I ran the bot. 

 

it DID NOT click ANY follow buttons.

 

It cycled 10 times and made the page scroll down but did not click any follows.

 

But it got me further than anything else i have tried.

Link to post
Share on other sites

Go ahead and grab the code. I made it for you and everyone else here who needs help in understanding this.

 

(and no, you are not a pain in the ass. All of us needs help from time to time, no matter if we are noobs or not).

Link to post
Share on other sites
ok.......I ran the bot. 

 

it DID NOT click ANY follow buttons.

 

It cycled 10 times and made the page scroll down but did not click any follows.

 

But it got me further than anything else i have tried.

 

 

That's really odd. It works perfectly for me for those Follow buttons visible after doing 10 x PgDn, but as I said, I have only tested this on the Followers page. Maybe the code looks differently on other pages.

 

Where there any followers that you didn't follow already?

Link to post
Share on other sites
Go ahead and grab the code. I made it for you and everyone else here who needs help in understanding this.

 

(and no, you are not a pain in the ass. All of us needs help from time to time, no matter if we are noobs or not).

 

 

I did grab it and i tried it.

 

What happened is explained above already.

Link to post
Share on other sites
That's really odd. It works perfectly for me for those Follow buttons visible after doing 10 x PgDn, but as I said, I have only tested this on the Followers page. Maybe the code looks differently on other pages.

 

 

maybe.  i can tell you exactly where I tried it.   i tried it on Eric Darius followers page     https://twitter.com/ericdarius/followers

Link to post
Share on other sites
Try your OWN followers. That was the case I used when creating the bot.

 

I am alreay following my own followers. But let me ask you this:  If the code on some one elses followers is different that the code on my own followers, might I just go into the node where that code is and change it to reflect the others follower?

Link to post
Share on other sites

I am looking at it right now and YES, the code differs, so what you need to do is to see if yu can find patterns in the HTML on the page where you want to do all these Follow button clicks and adjust the RegExp (in "find regular expression"), but seriously, I think you should start with something else than regexps if you are new to UBot.

 

(the time is 1:15 AM here so I have to get some sleep now, I'm afraid)

Link to post
Share on other sites
I am looking at it right now and YES, the code differs, so what you need to do is to see if yu can find patterns in the HTML on the page where you want to do all these Follow button clicks and adjust the RegExp (in "find regular expression"), but seriously, I think you should start with something else than regexps if you are new to UBot.

 

(the time is 1:15 AM here so I have to get some sleep now, I'm afraid)

 

 

Actually the regex tutorial was the ONLY thing i understood.

 

I am already looking at the code to see a pattern and i have tried a few already.

 

but i noticed that your loop scrolls the page 10 time THEN attempts to click the link defined by the regex.

 

That is not right is it?   Shouldn't the add to list node be inside the loop node?

Link to post
Share on other sites
(Great music by the way. I love that sax sound and the music. He is a "little bit" better than I am :) )

 

he is good.  He asked me to play in his band.....I turned him down. I dont travel any more.

Link to post
Share on other sites
Actually the regex tutorial was the ONLY thing i understood.

 

I am already looking at the code to see a pattern and i have tried a few already.

 

but i noticed that your loop scrolls the page 10 time THEN attempts to click the link defined by the regex.

 

That is not right is it?   Shouldn't the add to list node be inside the loop node?

 

The idea is to scroll down a few times (10 in this case to get a chunk of users you can follow. As long as you scrape the Twitter usernames AFTER you have scrolled down, I believe it should be ok.

 

The regexp is there to find all occurances (and return them to a list) of such patterns in the code, that is, to find all these user names. Actually I never click any links at all. If you have the Twitter username, you can do a navigate directly to https://twitter.com/{#theusername} , but maybe that was what you meant.

Link to post
Share on other sites
......... Actually I never click any links at all. If you have the Twitter username, you can do a navigate directly to https://twitter.com/{#theusername} , but maybe that was what you meant.

 

Huh?   No I meant that the script you gave me scrolls 1o times (or how ever many it is set to) end then moves to the nodes where you have commands to click.

 

In other words your script just scrolls the page. It does not click a follow button at all.

 

told you us newbies are a pain in the ass.  :P

Link to post
Share on other sites

Hahaha!  No no, dude, not a pain in the ass!

 

Here is a regexp that is "more right", but not entirely. I just HAVE to go to bed now!  :)

 

 

(?<=not\-following  protected\" data\-user\-id\=\"[0-9]+\" data\-screen\-name\=\")[a-zA-Z_-]+(?=\")
Link to post
Share on other sites

Hahaha!  No no, dude, not a pain in the ass!

 

Here is a regexp that is "more right", but not entirely. I just HAVE to go to bed now!  :)

 

 

(?<=not\-following  protected\" data\-user\-id\=\"[0-9]+\" data\-screen\-name\=\")[a-zA-Z_-]+(?=\")

 

 

Ok man.  I owe you one...or maybe two.   See you tomorrow.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...