Skip to content

Instantly share code, notes, and snippets.

@twotix
Last active December 16, 2015 06:09
Show Gist options
  • Save twotix/5389840 to your computer and use it in GitHub Desktop.
Save twotix/5389840 to your computer and use it in GitHub Desktop.
function alchemy() {
var ss = SpreadsheetApp.openById("");
var sheet = ss.getSheetByName("Bookmarks");
var lrow = sheet.getLastRow();
var dataRange = sheet.getRange(2, 1, lrow, 7);
var data = dataRange.getValues();
for (var i = 0; i < 10; ++i) {
var row = data[i];
var theurl = row[2];
var thesent = row[5];
if (theurl != "") {
if (thesent != "P"){
var rurl = ("http://access.alchemyapi.com/calls/url/URLGetText?extractLinks=1&apikey=&url=" + theurl);
var comp = ""
var text = UrlFetchApp.fetch(rurl).getContentText();
var doc = Xml.parse(text);
Logger.log(text);
var entry = doc.getElement().getElement("text");
var comp = entry.getText();
sheet.getRange(2+i, 6).setValue(comp);
sheet.getRange(2+i, 7).setValue("P");
Utilities.sleep(5000);
}}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment