Подписка электронных адресов на RSS

var timeout = 500;
var tries = 80000;

function waitFor(f) {
  setTimeout(function() {
    try {
      f();
    } catch (e) { 
      console.log('waitFor(): ' + e);
	  if (tries-- > 0) waitFor(f);
    }
  }, timeout);
}

var emails = ['openmeetings@mail.ru'];
w = window.open('http://blogtrottr.com/');

function f() {
  var e = emails.pop();
  if (!e) return;
  waitFor(function() {
    if (w.document.getElementById('btr_url').value != 'http://') throw 'Invalid btr_url field';
    if (w.document.getElementById('btr_email').value != '') throw 'Invalid btr_email field';
    var button = w.document.getElementsByClassName('feedme')[0];
    w.document.getElementById('btr_url').value = 'http://www.dataved.ru/feeds/posts/default?alt=rss';
    w.document.getElementById('btr_email').value = e;
    console.log('Subscribing ' + e);
    button.click();
    f();
  });
}

f();
Comments