DraftPad用アシストTweetSearchをガイドラインに合わせてみた

API1.1になって、厳密に規定されていました。


Developer Display Requirements | Twitter Developers
All timelines must allow users to view details of an Individual Tweet with the requirements above. H...
引用のデザインが決められています。発言者の著作権を守るための方法なので従わねばなりません。でも、細かいし難しい。基本は、タイムラインを表示するサードパーティのアプリがアナーキーな状態になっていたので、引用元が明確になるようにすることと、Twitter自体にすぐ飛べるようにすることが要点のようです。ただ、アシストでの実現は難しい。


DraftPad 1.6.2
分類: 仕事効率化,ユーティリティ
価格: 無料 (Manabu Ueno)

そんなわけで、別の方法を探りました。Web版Twitterにある「ツィートをサイトに埋め込む」に準拠します。実はこれ、scriptタグが入るのでhatenaでは表示しないかも。しかも、hatena自身のTwitter記法はAPI1.1にまだ合わせてないので、併用でもダメでしょう。まあ、ムリだったら無理に使わない方針で。

draftpad://self/web?source=<title>wait...</title><script>function main(x){open(x.URL)}location=%22draftpad:///webdelegate?load=main%26unloadconfirming=true%26unloadconfirmtitle=引用しますか?%26unloadconfirmdefault=はい%26unloadconfirmclose=いいえ%26unload=function(){location=\"draftpad:///webdelegate?load=f\";f=function(x){s=document.getElementsByClassName(\"tweet\")[0];if(!s)s=document.getElementById(\"views\");icon=s.getElementsByClassName(\"avatar\")[0].src;tweet=s.getElementsByClassName(\"dir-ltr\")[0].innerHTML.replace(/class=\"(.+?)\"/g,\"\");fullname=s.getElementsByClassName(\"full-name\")[0].innerText;name=s.getElementsByClassName(\"screen-name\")[0].innerText.substr(1);time=s.getElementsByClassName(\"timestamp-row\")[0];timestamp=(time)? time.innerText:s.getElementsByClassName(\"timestamp\")[0].innerText;url=location.href.replace(/mobile/,\"www\");link=x.STYLE.replace(/\\${url}/g,url).replace(/\\${name}/g,name).replace(/\\${fullname}/g,fullname).replace(/\\${tweet}/g,tweet).replace(/\\${timestamp}/g,timestamp).replace(/\\${icon}/g,icon);draftpad.replaceCurrent(link)}}%22</script>&URL=https://mobile.twitter.com/search?q=<@>&STYLE=<blockquote class=\"twitter-tweet\"><p>${tweet}</p>%26mdash; ${fullname} (@${name}) <a href=${url}>${timestamp}</a></blockquote><script async src=\"http://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>

登録リンクはこちら→ http://tinyurl.com/mcocp9o



キーワードを書いてアシストを起動すると、内蔵ブラウザでTwitterを検索します。引用したいTweetがあれば日付をタップし、単体で表示します。



そこで、内蔵ブラウザを閉じる。左上の[Done]で。



すると、こんな感じに貼りつきます。
って、・・・やっぱり、ダメかー。hatenaにscriptタグが弾かれちゃってますね。代用のblockquoteの部分で、何とか内容を見てもらうしかないか。



でも、この方法さえガイドラインから外れるかもしれない。少なくとも、STYLE以下のカスタマイズは禁止。ただ、今後Twitterが「ツィートをサイトに埋め込む」を変更した場合のために、STYLE形式は残しておきます。しかし、難儀だなあ。