Scrape my followers list... Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Scrape my followers list...

04 Apr 2018, 22:46

Hi all. I must confess that I would not even know where to begin on this, so any tips are welcome.
The idea is simple. I want to go down my list of followers on twitter, then copy each of their @Names to text file, one per line.
I attempted to do this in other languages and found it impossible.

Any ideas?

Thank you all for your time.
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: Scrape my followers list...

04 Apr 2018, 23:41

I do have an idea as to how this could be accomplished logically, but still not sure how I could implement it in AHK.
Use browser find to highlight something starting with @.
Detect and highlight all characters in the word.
Copy to clipboard.
Output to text.

Thats the idea written in logic form.
Thoughts?
trey ton

Re: Scrape my followers list...

04 Apr 2018, 23:47

Twitter lets you download a list of your followers, why build a scraper?
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: Scrape my followers list...

04 Apr 2018, 23:53

trey ton wrote:Twitter lets you download a list of your followers, why build a scraper?
Because I only want a list of the @names. Nothing more. Right now, that means a LOT of copy/paste activity.
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: Scrape my followers list...

05 Apr 2018, 08:12

I have spent a number of hours learning as much as I can about AHK. I must admit, this is unlike any language I have ever used before.
I am beginning to wonder if what I want to do is even possible in this language. I know that I could do this if I knew anything about writing browser addons, but sadly I am not even close to being able to do that.

I want to make this clear... I hate the idea of asking people to do something for me. The only reason that I formatted the post this way is because I am still very new to this language. With a few months of practice I should have a decent grasp on it, but I was just hoping someone might have an idea for now.
Rane Orshine

Re: Scrape my followers list...

05 Apr 2018, 09:49

Draygoes wrote:I have spent a number of hours learning as much as I can about AHK. I must admit, this is unlike any language I have ever used before.
I am beginning to wonder if what I want to do is even possible in this language. I know that I could do this if I knew anything about writing browser addons, but sadly I am not even close to being able to do that.

I want to make this clear... I hate the idea of asking people to do something for me. The only reason that I formatted the post this way is because I am still very new to this language. With a few months of practice I should have a decent grasp on it, but I was just hoping someone might have an idea for now.
Many plugings will get you your followers, ahk can do it too but just use what works already
User avatar
FanaticGuru
Posts: 1908
Joined: 30 Sep 2013, 22:25

Re: Scrape my followers list...

05 Apr 2018, 16:09

Draygoes wrote:
trey ton wrote:Twitter lets you download a list of your followers, why build a scraper?
Because I only want a list of the @names. Nothing more. Right now, that means a LOT of copy/paste activity.
If you can download the followers to a text file by any means, it will then be much easier to get AHK to pull out of that text file a list of just the followers' names. Less than a dozen lines of code.

Not as good but if you just get all the data on to the clipboard then it is pretty trivial to get every word starting with @ out of the clipboard.

This code will list every word starting with @ that is currently on the clipboard.

Code: Select all

X:=1
while (X := RegExMatch(Clipboard, "(@\w*)", M, X+StrLen(M)))
    MsgBox % M1
So you just highlight a bunch of text and copy to clipboard, then run this script.
With a couple more lines the script instead of listing them one at a time could create a list and save as a text file.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
neverlevel
Posts: 60
Joined: 13 Apr 2016, 22:02

Re: Scrape my followers list...  Topic is solved

05 Apr 2018, 17:51

just curious ...if this works.

Code: Select all

X:=1
while (X := RegExMatch(Clipboard, "(@\w*)", M, X+StrLen(M)))
   {
   ; MsgBox % M1
	FileAppend, %M1%`n, Test.txt
	}
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: Scrape my followers list...

05 Apr 2018, 18:31

neverlevel wrote:just curious ...if this works.

Code: Select all

X:=1
while (X := RegExMatch(Clipboard, "(@\w*)", M, X+StrLen(M)))
   {
   ; MsgBox % M1
	FileAppend, %M1%`n, Test.txt
	}
I just tried it. It placed a single @ char in the text file.
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: Scrape my followers list...

05 Apr 2018, 18:32

But the code with the message box worked perfectly!
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: Scrape my followers list...

05 Apr 2018, 18:37

Ok, I had made a mistake with the append code. I forgot to copy the list. It works great!
Is there any way to have each name in a new line?

Thanks all! I mean that!
neverlevel
Posts: 60
Joined: 13 Apr 2016, 22:02

Re: Scrape my followers list...

05 Apr 2018, 18:38

should already be that way...
my test has 3 lines.. the 'n does new line


try taking the text file....copying it to clipboard....deleting the current messed up version and running the code again? i dont know what format your clipboard has that may be messing it up
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: Scrape my followers list...

05 Apr 2018, 18:52

So this is strange.
I uncommented the msgbox and it works perfectly. Each to a new line. I remove the message box completely, and it works great. It screwed up with the commented message box in there. I can even repeat by putting the commented out message box back.
Just find that strange.

That works perfectly man. Thank you very much. You guys have saved me a LOT of time.
neverlevel
Posts: 60
Joined: 13 Apr 2016, 22:02

Re: Scrape my followers list...

05 Apr 2018, 18:57

np. good luck with your future projects

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, VaritySpice and 120 guests