Results 1 to 3 of 3

Thread: Read/Extract & Parse Firefox History

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Read/Extract & Parse Firefox History

    I've been looking for a way to get the website history of firefox for a while, but I couldn't find any existing code that did it, so I coded my own.

    This function will read the Firefox history for all profiles on the computer and returns a string containing all the URLs, separated by vbNewLine.

    Let me know what you think
    VB Code:
    1. Private Function ReadFfHistory() As String
    2. Dim fso As FileSystemObject
    3. Dim tmp As String
    4. Dim Fldr As Folder
    5. Dim F As Folder
    6. Dim Strm As TextStream
    7. Dim Parsed As String
    8. Dim Hist As String
    9.  
    10. Dim urlStart As Single
    11. Dim urlEnd As Single
    12.  
    13. Set fso = New FileSystemObject
    14.  
    15. If fso.FolderExists(Environ("appdata") & "\Mozilla\Firefox\Profiles") = False Then
    16.     'cant find firefox profiles
    17.     Exit Function
    18. End If
    19.  
    20. Set Fldr = fso.GetFolder(Environ("appdata") & "\Mozilla\Firefox\Profiles")
    21.  
    22. For Each F In Fldr.SubFolders 'Loop through each profile
    23.     If fso.FileExists(F.Path & "\history.dat") Then
    24.         'Read in history
    25.         Set Strm = fso.GetFile(F.Path & "\history.dat").OpenAsTextStream(ForReading)
    26.         tmp = Strm.ReadAll
    27.         Strm.Close
    28.         tmp = Replace$(tmp, "\" & vbNewLine, vbNullString)
    29.         'Parse history
    30.         Do While InStr(urlEnd + 1, tmp, "=http") <> 0
    31.             urlStart = InStr(urlEnd + 1, tmp, "=http") + 1
    32.             urlEnd = InStr(urlStart, tmp, ")")
    33.             Parsed = Parsed & Mid$(tmp, urlStart, urlEnd - urlStart) & vbNewLine
    34.         Loop
    35.         Hist = Hist & F.Name & ":" & vbNewLine & Parsed & vbNewLine
    36.         Parsed = vbNullString
    37.     End If
    38.     urlEnd = 0
    39. Next
    40.  
    41. Set Strm = Nothing
    42. Set fso = Nothing
    43.  
    44. ReadFfHistory = Hist
    45. End Function
    Last edited by shirazamod; Aug 22nd, 2007 at 06:01 AM.
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  2. #2
    Addicted Member Vanasha's Avatar
    Join Date
    Jun 2007
    Location
    In a bin.>_>
    Posts
    152

    Re: Read/Extract & Parse Firefox History

    Hey nice code! I like your other work too.
    Quote Originally Posted by Vanasha
    Sorry, i'm slow.


  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Read/Extract & Parse Firefox History

    Thanks I'm glad you like it
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width