Hack Forums
[.NET] Twitter Account & Tweet Scraper - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Twitter Account & Tweet Scraper (/showthread.php?tid=3284666)



Twitter Account & Tweet Scraper - Infinit3 - Feb 25, 2013

I created this while learning Regex, This will scrape a persons tweets or will scrape twitter accounts from the search.

GIF
Spoiler (Click to View)

Screenshot
Spoiler (Click to View)

Also I couldn't work out how to remove duplicates so I used this snippet here.

Would like feedback on what/if I could of done it better etc

Download:
Source & Binary

VirusTotal:
Here..

Thanks(First post in vb forum)


* - Yui Asuna - Feb 25, 2013

Here's my note: 4/10. (This used to be a 6, when I saw point 4)
And now, here's why:

1. WebRequest in the UI thread. Bad thing is bad. Multi-threading dude !
2. "https://twitter.com/search/realtime?q=" + bb + "&src=typd")" No. When you want to concat strings, you should use "&"
3. This code below V. First, it's alway better to use explicit variable name. Second, why aren't they declared as string ? (You can also reduct this in one line)
Code
Dim lol = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim la As String = "\twitter.txt"
Dim aaa = lol + la
4. Just saw it when writing this line. Just NO. You don't use threading for webrequest, so what is the point of this ? VERY bad habit, and for nothing.
Code
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  CheckForIllegalCrossThreadCalls = False
    End Sub
5.
Code
Private Sub SWAG()
... Not a bad point in itself, just ... Explicit name, please, and not that !_!
[6.] Yeah, just one remark, no big deal:
Code
If CheckBox2.Checked = True Then
You can just write "if CheckBox2.Checked Then"

That's all. Be sure to correct these points in the future ;)
Didn't really looking in the RegEx and request in themself, I just saw some loose of time.
This post is not offensive. It's only meant to help.


* - Infinit3 - Feb 25, 2013

(Feb 25, 2013 07:55 PM)PsyCh0TyK Wrote:  Here's my note: 4/10. (This used to be a 6, when I saw point 4)
And now, here's why:

Thanks for the feedback will have a look back on everything


* - Yui Asuna - Feb 25, 2013

(Feb 25, 2013 07:59 PM)๖ۣۜHatreȡ Wrote:  Thanks for the feedback will have a look back on everything

No problem dude.
Oh thanks, someone that don't get mad when you correct them :)
Welcome to the .Net section dude !


* - Infinit3 - Feb 25, 2013

(Feb 25, 2013 08:00 PM)PsyCh0TyK Wrote:  No problem dude.
Oh thanks, someone that don't get mad when you correct them :)
Welcome to the .Net section dude !
Why would I be mad ?, I asked for feedback and ways to improve and I got it.

Thanks :)


* - Cecilia - Feb 25, 2013

(Feb 25, 2013 08:02 PM)๖ۣۜHatreȡ Wrote:  Why would I be mad ?, I asked for feedback and ways to improve and I got it.

Thanks :)

With the Control.CheckForIllegalCrossThreading, you can have no need for that by making simple little delegate subs. Let me throw you an example to give you something to work on:

PHP Code

<?php 
Delegate Sub ChangeLog
()
    Private 
Sub UpdateLog(ByVal text As String, ByVal log As RichTextBox)
  If 
InvokeRequired Then
    Invoke
(New ChangeLog(Sub() UpdateLog(text, log)))
  Else
    
log.AppendText(text)
  
End If
    
End Sub 

Pretty self explanatory, you call with UpdateLog(username, RichTextBox1)

Just an example.
Good luck in future programs though.


* - Infinit3 - Feb 25, 2013

(Feb 25, 2013 09:04 PM)Brynaldo8 Wrote:  Just an example.
Good luck in future programs though.

Thanks for the example
I'd like to PM you with some questions.


* - Bird Is The Word - Feb 25, 2013

I feel like learning Regex now.. Anyways, thanks for sharing this. 🙂


* - deiski - Feb 25, 2013

I recommend uninstalling Windows Eight as fast as you can.


* - Tidas - Feb 25, 2013

PHP Code

<?php 
CheckForIllegalCrossThreadCalls 
= False 

Never ever do this again OP. This is a very bad habit.


* - Infinit3 - Feb 25, 2013

(Feb 25, 2013 10:49 PM)Cyan Wrote:  I recommend uninstalling Windows Eight as fast as you can.

I would like too but I can't as this laptop came with it and most of the drivers are win8 only for it.


* - deiski - Feb 25, 2013

(Feb 25, 2013 11:00 PM)๖ۣۜHatreȡ Wrote:  I would like too but I can't as this laptop came with it and most of the drivers are win8 only for it.

I feel sorry for when your computer breaks then, I had it on my 16GB PC, I had to force shut it down by unplugging it, that will then fuck your C:\ drive in the dog, then you have to then download a LIVE-CD OS and mount your Hard Drive, format it from there, and then buy Windows 7.


* - Infinit3 - Feb 25, 2013

(Feb 25, 2013 11:04 PM)Cyan Wrote:  I feel sorry for when your computer breaks then, I had it on my 16GB PC, I had to force shut it down by unplugging it, that will then fuck your C:\ drive in the dog, then you have to then download a LIVE-CD OS and mount your Hard Drive, format it from there, and then buy Windows 7.

I haven't had much problems with it so far, I also have my whole HDD backuped, It isn't so bad after installing ClassicShell and some other tweaks, My other workstation has windows 7, So I should be alright.


Ok noted don't ever, ever use CheckForIllegalCrossThreads again or the world will end. Any other way other than delegates ?