Raised This Month: $ Target: $400
 0% 

Web Data Extraction - How do you do?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
stupok
Veteran Member
Join Date: Feb 2006
Old 05-12-2008 , 21:18   Re: Web Data Extraction - How do you do?
Reply With Quote #5

Man, I'm starting to get frustrated with Platypus + Greasemonkey. I'm sure that Greasemonkey works just fine, but Platypus is horrid. None of the changes I make are saved.

I'm slowly figuring out how to piece together a script without using Platypus, but I'm using the code Platypus generates to guide me.

If there's a kind soul out there who has made Greasemonkey scripts in the past and doesn't mind helping me, I'd like to convert the regex and string manipulation commands below from Visual Basic to Javascript. If you could get a fully functional script going, all the better.

Also, feel free to point out any mistakes I've made.

Code:
    Public Function GetForcast(ByVal str As String) As String
        Dim myMatch As Match
        Dim myMatches As MatchCollection

        myMatch = Regex.Match(str, "WINTHROP")

        str = str.Substring(myMatch.Index())

        myMatch = Regex.Match(str, "\n")

        str = str.Substring(0, myMatch.Index())

        str = str.Replace("<P>", "")

        myMatch = Regex.Match(str, "-\d")

        str = str.Substring(myMatch.Index() + 1)

        str = str.Replace(". .", "..")
        str = str.Replace("....", "<br><br><b>")
        str = str.Replace("...", "</b><br>")
        str = str.Replace("..", "<br><br><b>")

        myMatch = Regex.Match(str, "M")

        str = str.Insert(myMatch.Index() - 4, ":")
        str = str.Insert(0, "<html><center><b><FONT FACE=""Verdana"" SIZE=""1"">")
        str = str.Insert(str.Length, "</FONT></center></html>")

        str = str.Replace(".", "<br>")

        myMatches = Regex.Matches(str, "[A-Z]\d")

        For Each myMatch In myMatches
            str = str.Insert(myMatch.Index() + 3, " ")
        Next

        Return str
    End Function

EDIT:
I finally fixed my Greasemonkey script and I have a pretty good result. The Visual Basic program, for some reason, let me control which text is bold and which is not with more fidelity, but I can't figure out how to get exactly the same result with the Greasemonkey script. Whatever, I did it. Hooray!
__________________

Last edited by stupok; 05-12-2008 at 21:51.
stupok is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode