http - save a webpage with VBS -
when use firefox "https://twitter.com/search?q=vbs", works , see tweets (without ever logging on). but, when try use simplest vbs-scripting way xmlhttp, seems declared mobile user twitter , don't search results. so, how can change vbs code below make work? in principle, seems should able set objxmlhttp property spoof browser, again, microsoft wouldn't give me freedom easily. comments great!
strfileurl = "https://twitter.com/search?q=vbs" strhdlocation = "c:\users\me\webpages\saved_tweets.html" set objxmlhttp = createobject("msxml2.xmlhttp") objxmlhttp.open "get", strfileurl, false objxmlhttp.send() if objxmlhttp.status = 200 set objadostream = createobject("adodb.stream") objadostream.open objadostream.type = 1 objadostream.write objxmlhttp.responsebody objadostream.position = 0 set objfso = createobject("scripting.filesystemobject") if objfso.fileexists(strhdlocation) objfso.deletefile strhdlocation set objfso = nothing objadostream.savetofile strhdlocation objadostream.close set objadostream = nothing end if set objxmlhttp = nothing
maybe fake user agent (browser) in http request twitter consider browser desktop :
set objxmlhttp = createobject("msxml2.xmlhttp") objxmlhttp.open "get", strfileurl, false objxmlhttp.setrequestheader "user-agent", "mozilla/5.0 (windows nt 6.1; win64; x64; rv:23.0) gecko/20131011 firefox/23.0" objxmlhttp.send()
Comments
Post a Comment