-
Aug 22nd, 2007, 05:50 AM
#1
Thread Starter
Fanatic Member
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:
Private Function ReadFfHistory() As String
Dim fso As FileSystemObject
Dim tmp As String
Dim Fldr As Folder
Dim F As Folder
Dim Strm As TextStream
Dim Parsed As String
Dim Hist As String
Dim urlStart As Single
Dim urlEnd As Single
Set fso = New FileSystemObject
If fso.FolderExists(Environ("appdata") & "\Mozilla\Firefox\Profiles") = False Then
'cant find firefox profiles
Exit Function
End If
Set Fldr = fso.GetFolder(Environ("appdata") & "\Mozilla\Firefox\Profiles")
For Each F In Fldr.SubFolders 'Loop through each profile
If fso.FileExists(F.Path & "\history.dat") Then
'Read in history
Set Strm = fso.GetFile(F.Path & "\history.dat").OpenAsTextStream(ForReading)
tmp = Strm.ReadAll
Strm.Close
tmp = Replace$(tmp, "\" & vbNewLine, vbNullString)
'Parse history
Do While InStr(urlEnd + 1, tmp, "=http") <> 0
urlStart = InStr(urlEnd + 1, tmp, "=http") + 1
urlEnd = InStr(urlStart, tmp, ")")
Parsed = Parsed & Mid$(tmp, urlStart, urlEnd - urlStart) & vbNewLine
Loop
Hist = Hist & F.Name & ":" & vbNewLine & Parsed & vbNewLine
Parsed = vbNullString
End If
urlEnd = 0
Next
Set Strm = Nothing
Set fso = Nothing
ReadFfHistory = Hist
End Function
Last edited by shirazamod; Aug 22nd, 2007 at 06:01 AM.
-
Sep 12th, 2007, 12:54 PM
#2
Addicted Member
Re: Read/Extract & Parse Firefox History
Hey nice code! I like your other work too.
Originally Posted by Vanasha
Sorry, i'm slow.
-
Sep 12th, 2007, 01:01 PM
#3
Thread Starter
Fanatic Member
Re: Read/Extract & Parse Firefox History
Thanks I'm glad you like it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|