RRRS

mayokara氏謹製http://feedgen.appjet.net で遊んでみた。

単純なフィード生成ならPipesでPageFetchするより遙かに使いやすい。
変にタグをいじられたりもしないし。

+

バグを見つけたのでパッチを。

--- feedgen.js	2008-09-23 17:02:48.789108300 +0900
+++ feed9en.js	2008-09-23 18:18:10.659308300 +0900
@@ -59,17 +59,18 @@
     link: h(p.url),
     description: h(p.feeddescription || (res.data.match(/<meta[^<]+name=(["'])description\1[^<]+content=(["'])([\s\S]+?)\2[^<]*>/i) || {})[3] || ""),
     language: h(p.language || (res.data.match(/<html[^<]+lang=(["'])([\s\S]+?)\1[^<]*>/i) || {})[2] || ""),
-    date: h(res.headers["Last-Modified"][0] || res.headers["Date"][0]),
+    date: h((res.headers["Last-Modified"] || {})[0] || (res.headers["Date"] || {})[0]),
     self: h("http://" + appjet.appName + "." + appjet.mainDomain + request.path + "?" + request.query),
 };
 var re = new RegExp(p.re, "mg"), items = [], m;
+var [t, d] = [p.title, p.description].map(function(x){ return (x || "").split(" ") });
 while (m = re.exec(res.data)) {
     var guid = md5(m[0]);
     items.push({
-        title: h(m[p.title]),
+        title: h([m[x] || x for each(x in t)].join('')),
         link: h(channel.link + "#" + guid),
         guid: guid,
-        description: m[p.description],
+        description: [m[x] || x for each(x in d)].join(''),
     });
 }
 if (items.length > MAX_ITEMS_COUNT) items = items.slice(0, MAX_ITEMS_COUNT);

ついでに title/description の自由度を向上

++

しかしRRRSってなんやねん。RRSSならまだ分かった。

+++

採用していただいた。
前後に空白を入れなければ素の数字も使えるのでほぼ不自由無し。