Skip to content

Instantly share code, notes, and snippets.

@ntoshev
Created May 17, 2012 07:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ntoshev/aaf74e50b9a281396722 to your computer and use it in GitHub Desktop.
Save ntoshev/aaf74e50b9a281396722 to your computer and use it in GitHub Desktop.
Web automation with Google Apps
function test(){
var url = "http://pravo5.ciela.net/Document.aspx?id=244946&category=info&idBase=InfoBaseTR&lang=bg-BG&interpretedQuery=130523801";
var h = {
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Charset":"windows-1251,utf-8;q=0.7,*;q=0.3",
"Accept-Encoding":"gzip,deflate,sdch",
"Accept-Language":"en-US,en;q=0.8,bg;q=0.6",
"Cache-Control":"max-age=0",
"Connection":"keep-alive",
"Cookie":"ASP.NET_SessionId=2ourau45hrg25245p2a50x45; .CIELA5_WEB_CREDENTIALS=usrn=jnZeNhLQ6968CmAj6qOHGw==&pswd=RXwwaulzP6BIQ/HBjOru5w==",
"User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/10.10 Chromium/17.0.963.79 Chrome/17.0.963.79 Safari/535.11"
};
var response = UrlFetchApp.fetch(url, {headers:h});
Logger.log(response.getResponseCode());
Logger.log(response.getContentText().match("Никола"));
Logger.log(response.getContentText());
Logger.log("Done.");
return;
var doc=DocumentApp.openById("1Vg3HMzePPuww7xwhn0k8gaGPgo92R9GBY-4k7sDhfQM");
Browser.msgBox(Utilities.jsonStringify(doc.getParagraphs()[5].getChild(0).getAttributes()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment