Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Name: InstaMeta WScript Version 2.0
- ' File: InstaMeta_v2.0_w.vbs
- ' Licence: N/A
- ' Author: Mark Albanese (Devious_Malcontent)
- ' Date: 3 August 2014
- ' Version: 2.0
- ' Release: 1
- ' Language: VBScript
- ' Compiler: N/A
- ' Notes: Your Instagram account must be public.
- ' Default encoding is ANSI, however this can be changed to UTF by opening the file in notepad and saving it as UTF format.
- ' Usage: Save as "InstaMeta_v2.0_w.vbs"
- ' Run this by double clicking on the file name in Windows, enter Instagram username when prompted,
- ' wait for the program to respond with done and then the output filename.
- Set objFSO = Createobject("Scripting.FileSystemObject")
- Set objShell = wscript.createobject("wscript.shell")
- username = InputBox("Please enter Instagram Username:", "Instagram Username")
- OutputFileName = username & "_Instagram_Metadata" & Replace(Replace(Replace(FormatDateTime(Now()),"/","."),":",".")," ","_") & ".csv"
- it=1
- strFileURL = "http://www.iphoneogram.com/" & username
- strHDLocation = objShell.CurrentDirectory & "\page" & it & ".html"
- Dim objFile, strLine, out
- Set out = objFSO.OpenTextFile(objShell.CurrentDirectory & "\" & OutputFileName, 2, True)
- Call getMeta(strFileURL,strHDLocation)
- objFile.Close
- Do Until it=0
- strHDLocation = objShell.CurrentDirectory & "\page" & it & ".html"
- If objFSO.Fileexists(strHDLocation) Then
- objFSO.DeleteFile strHDLocation
- End If
- it=it-1
- Loop
- Set objFSO = Nothing
- Wscript.Echo "Done! Output File Name: " & OutputFileName
- Function ReplacePattern(patrn, replStr, str1)
- Dim regEx
- Set regEx = New RegExp
- regEx.Pattern = patrn
- regEx.IgnoreCase = True
- ReplacePattern = regEx.Replace(str1, replStr)
- End Function
- Sub getMeta(strFileURL,strHDLocation)
- Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
- objXMLHTTP.open "GET", strFileURL, false
- objXMLHTTP.send()
- If objXMLHTTP.Status = 200 Then
- Set objADOStream = CreateObject("ADODB.Stream")
- objADOStream.Open
- objADOStream.Type = 1
- objADOStream.Write objXMLHTTP.ResponseBody
- objADOStream.Position = 0
- If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
- objADOStream.SaveToFile strHDLocation
- objADOStream.Close
- Set objADOStream = Nothing
- End if
- Set objXMLHTTP = Nothing
- Set objFile = objFSO.OpenTextFile(strHDLocation, 1)
- Dim strSearchFor1, strSearchFor2, strSearchFor3, strSearchFor4, strSearchFor5
- strSearchFor1 = "text com"
- strSearchFor2 = "p-time-block"
- strSearchFor3 = "Original Image"
- strSearchFor4 = "View in Instagram web page"
- strSearchFor5 = "id=""next-link"">More"
- GetNextLine = False
- Do While Not objFile.AtEndOfStream
- strLine = objFile.readline
- If GetNextLine = True Then
- If InStr(1, strLine, "</p>") > 0 then
- GetNextLine = False
- End If
- strLine = Replace(strLine,",",",")
- strLine = Replace(strLine,"</p>"," ")
- strLine = Replace(strLine,vbCrLf,"")
- strLine = Replace(strLine,vbLf,"")
- out.Write " " & strLine
- End If
- If InStr(1, strLine, strSearchFor1) > 0 then
- If InStr(1, strLine, "</p>") = 0 then
- GetNextLine = True
- strLine = ReplacePattern("target=""_blank"">", "target=""", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = Replace(strLine," ","")
- strLine = Replace(strLine,",",",")
- strLine = Replace(strLine,vbCrLf,"")
- strLine = Replace(strLine,vbLf,"")
- out.Write strLine
- Else
- strLine = ReplacePattern("target=""_blank"">", "target=""", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = Replace(strLine," ","")
- strLine = Replace(strLine,",",",")
- strLine = Replace(strLine,vbCrLf,"")
- strLine = Replace(strLine,vbLf,"")
- out.Write strLine
- End if
- End If
- If InStr(1, strLine, strSearchFor2) > 0 then
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = Replace(strLine,vbCrLf,"")
- strLine = Replace(strLine,vbLf,"")
- out.Write strLine & vbCrLf
- End If
- If InStr(1, strLine, strSearchFor3) > 0 then
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = ReplacePattern("<[^>]*>", "", strLine)
- strLine = Replace(strLine,"<a href=","")
- strLine = Replace(strLine,""" target=""_blank"" rel=""nofollow"">Original Image</a></div>","")
- strLine = ReplacePattern("""http://.*/", "", strLine)
- strLine = Replace(strLine," ","")
- strLine = Replace(strLine,vbCrLf,"")
- strLine = Replace(strLine,vbLf,"")
- out.Write "," & strLine & ","
- End If
- If InStr(1, strLine, strSearchFor4) > 0 then
- strLine = Replace(strLine,"<div class=""p-l-block""><span class=""fa fa-instagram""></span> <a href=""","")
- strLine = Replace(strLine,""" target=""_blank"">View in Instagram web page</a></div>","")
- strLine = Replace(strLine,vbCrLf,"")
- strLine = Replace(strLine,vbLf,"")
- out.Write strLine & ","
- End If
- If InStr(1, strLine, strSearchFor5) > 0 then
- inurl = Replace(strLine,"<a href=""","")
- inurl = Replace(inurl,""" id=""next-link"">More »</a>","")
- strFileURL = "http://www.iphoneogram.com/" & inurl
- it=it+1
- strHDLocation = objShell.CurrentDirectory & "\page" & it & ".html"
- Call getMeta(strFileURL,strHDLocation)
- End If
- Loop
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement