Meteor Scrape Cross Domain Website

Go out and fetch the title of a website not on your server.

In the /server/app.js file:

Meteor.startup(function () {

  Meteor.methods({
    scrapeTitle: function(url) {
      check(url, String);

      var result = Meteor.http.get(url);

      var str = result.content;
      var title = str.substring(str.lastIndexOf("<title>")+7,str.lastIndexOf("<\/title>"));

      return title;

    }
  });
});

In the corresponding template helper:

Template.templateName.created = function() {
  Session.set('title', '');
}

Template.templateName.helpers({
  titleOfPage: function() {
    return Session.get('title');
  }
});

Template.templateName.events({
  'click .callServer': function() {
    Meteor.call('scrapeTitle', url, function(error, result) {
      if (error) return alert(error.reason);
      $('#title').val(result);
      Session.set('title', result);
    });
  }
});

In the template:

<button class="callServer" type="button">Suggest title</button>
<input type="text" id="title" name="title" value="">

needed Meteor packages: - http - audit-argument-checks

Read More

Meteor Reset Facebook App Id

It is possible to reset the Facebook App ID and secret without meteor reset.

meteor mongo
db.meteor_accounts_loginServiceConfiguration.find()  // use _id from here
db.meteor_accounts_loginServiceConfiguration.update({_id:"xxx"},{$set:{"appId" : "<new app id>", "secret" : "<new secret>"}});

needed Meteor package:

meteor add accounts-facebook
Read More