用 Ubiquity 发飞信

May 2nd, 2009 at 12:51 pm

我的推友里看到这篇 中国移动飞信 Fetion API 免费发短信的一些应用。文章里面有个 Ubiquity 命令,很简陋,而且还是新建标签式的。

输入在 Ubiquity 里输入 command-editor 或者打开 chrome://ubiquity/content/editor.html,在输入框的末尾输入以下命令。红色部分需要修改。

CmdUtils.CreateCommand({
  name: "sms",
  takes: {status: noun_arb_text},
  homepage: "http://blog.loland.net/2008/09/28/58.et",
  author: {name: "sfufoet", homepage: "http://blog.loland.net/"},
  license: "MPL",
 
  preview: function(previewBlock, statusText, mods) {
    var previewTemplate = '</div><br/>' +
                          "将要发送到手机的的内容如下: <br/>" +      
                          "<b>${status}</b><br /><br />" +
                          " 总字数为: <b>${chars}</b>";
if(statusText.text=="me")
    statusText.text = "你的手机号&msg=" + context.focusedWindow.getSelection() + " " + context.focusedWindow.location;
else
    statusText.text = statusText.text + "&msg=" + context.focusedWindow.getSelection() + " " + context.focusedWindow.location;

    var previewData = {
      status: context.focusedWindow.getSelection() + " " + context.focusedWindow.location,
      chars: statusText.text.length
    };
     
    var previewHTML = CmdUtils.renderTemplate(previewTemplate,
                                               previewData);
  
    previewBlock.innerHTML = previewHTML;
  },
 
  execute: function(statusText) {
    jQuery.ajax({
      type: "Get",
      url: "https://fetionAPI.appspot.com/api/?from=你的手机号&pw=飞信密码&to=" + statusText.text,
      error: function() {
        displayMessage("发送失败");
      },
      success: function() {
        displayMessage("发送成功");
      }
    });
  }
});

用法:

  1. 输入 sms 手机号,回车后会把当前选中的文字和当前网址发生到对方手机上。
  2. 输入 sms me,就会发给自己。

我用的这个飞信 API 是用 Google App Engine 打造的。注意:若短时间内循环大量发送短信者,将直接封号封 IP !

如果不小心被封了,可以试试 中国移动飞信 Fetion API 免费发短信的一些应用 里的另外一个 API。

13 Responses

  1. 沙发

    LeON - May 2nd, 2009 at 1:18 pm Notify
  2. @LeON: 太不厚道了,你把沙发抢了还 RT 个啥沙发还空着啊…

    fisio - May 2nd, 2009 at 1:21 pm Notify
  3. @LeON:
    太不厚道。我也是被骗过来的……

    Vincent - May 2nd, 2009 at 1:25 pm Notify
  4. 如果能够实现自定义编辑组群发送就更好了。

    八百步 - May 2nd, 2009 at 1:35 pm Notify
  5. 前排

    王小闲人 - May 2nd, 2009 at 2:13 pm Notify
  6. 不错,但是不是很经常使用命令行,而且这个只能给自己发短信!

    xiao3 - May 2nd, 2009 at 2:18 pm Notify
  7. @xiao3: 典型的回帖不看贴。

    sfufoet - May 2nd, 2009 at 4:30 pm Notify
  8. @八百步: 你可以自己修改脚本为群组的发送啊。

    sfufoet - May 2nd, 2009 at 4:31 pm Notify
  9. 哈哈,twitter召唤了sfufoet修改。谢谢了,比我那个粗糙的原始代码强大多了。

    daibin - May 2nd, 2009 at 11:29 pm Notify
  10. 我怎么测试的代码不能用,我又改回我那个弱智代码了。可能是我哪里出了问题,要不直接传一个js文件上来?

    daibin - May 6th, 2009 at 9:26 am Notify
  11. @daibin: 你先检查一下,我文中标记为红色的地方,你正确修改了没有吧。

    sfufoet - May 6th, 2009 at 12:32 pm Notify
  12. 顺便提一下,飞信要收费了。。。。。哎呀。。。。。

    roysing - August 6th, 2009 at 4:34 pm Notify
  13. @roysing: 好像是会员才收费,非会员继续免费。。。

    sfufoet - August 6th, 2009 at 6:29 pm Notify