「twitter.dms」の版間の差分
提供: Yourpedia
細 (Mario Yonezawa (トーク) による版 363308 を取り消し) |
|||
| (2人の利用者による、間の9版が非表示) | |||
| 10行目: | 10行目: | ||
//Dorothy2 | //Dorothy2 | ||
//caption=twitter静止画 | //caption=twitter静止画 | ||
| − | //version=0. | + | //version=0.02 |
//hint=twitter.com・twilog.orgのページからURLを渡してください | //hint=twitter.com・twilog.orgのページからURLを渡してください | ||
//match=twitter.com/[^/]+/status | //match=twitter.com/[^/]+/status | ||
| 18行目: | 18行目: | ||
//end | //end | ||
//created 12,Dec.,2011 by Abcdefgh | //created 12,Dec.,2011 by Abcdefgh | ||
| − | // | + | //modified 10,Mar.,2012 by Abcdefgh |
| + | //modified 11,Sept.,2012 by Abcdefgh | ||
| + | //オリジナルサイズ画像DLに対応 | ||
function(){ | function(){ | ||
| 24行目: | 26行目: | ||
// 画像ページURLをモバイルページURLに変換 | // 画像ページURLをモバイルページURLに変換 | ||
var title = urlinfo.url; | var title = urlinfo.url; | ||
| + | title = title.replace(/http:/,"https:"); | ||
title = title.replace(/\/twitter[.]com/,"/mobile.twitter.com"); | title = title.replace(/\/twitter[.]com/,"/mobile.twitter.com"); | ||
var url = new URL(title); | var url = new URL(title); | ||
urlinfo.url = url.url; | urlinfo.url = url.url; | ||
headers.host = url.host; | headers.host = url.host; | ||
| − | // | + | // 画像ページをダウンロード |
common_load('download'); | common_load('download'); | ||
var http = download(urlinfo.url); | var http = download(urlinfo.url); | ||
| 35行目: | 38行目: | ||
} | } | ||
// 画像URLを抽出 | // 画像URLを抽出 | ||
| − | if (!http.data.match(/href=\"([^"]+twimg[^"]+ | + | if (!http.data.match(/(href|src)=\"([^"]+twimg[.]com\/media\/[^\/"]+)\"/)) { |
println('error---> 目的の画像が見つかりません'); | println('error---> 目的の画像が見つかりません'); | ||
exit(); | exit(); | ||
} | } | ||
| − | var title=RegExp.$ | + | var title=RegExp.$2; |
| − | var title=title.replace(/ | + | var title=title.replace(/https/,"http"); |
| + | var title=title.replace(/:(small|med|large)/,""); | ||
| + | var title=title + ":orig"; | ||
var url = new URL(title); | var url = new URL(title); | ||
| 46行目: | 51行目: | ||
headers.host = url.host; | headers.host = url.host; | ||
//ファイル名を抽出 | //ファイル名を抽出 | ||
| − | if (!title.match(/([^\/:]+): | + | if (!title.match(/([^\/:]+):orig$/)) { |
println('error---> ファイル名が見つかりません'); | println('error---> ファイル名が見つかりません'); | ||
exit(); | exit(); | ||
2019年2月7日 (木) 23:47時点における最新版
Irvineを使ってTwitterの静止画を落とすためのスクリプト。Twitter・Twilogのページから「IrvineへすべてのURLを送る」で使う。本スクリプトは「t-co.dms」からの呼び出しにも使われる。
- ここからIrvineとDorothy2.zipをDL、インストールする
- 「(Irvineが有るフォルダ)¥Dorothy2¥program¥」に「twitter.dms」を以下の内容で作成する
- Irvineを起動後、上記サイトに出てる設定を行う
- 「ツール」→「メインメニュー」→「動画ダウンロード2設定」で「twitter静止画」にチェックを入れて、「ファイル」→「保存して終了」をクリック、それ以外は同様
- 呼び出し元の「t-co.dms」も上記同様に用意しておく
- 後は、ほぼ上記サイトの説明通り
//Dorothy2
//caption=twitter静止画
//version=0.02
//hint=twitter.com・twilog.orgのページからURLを渡してください
//match=twitter.com/[^/]+/status
//author=Abcdefgh
//path=program
//priority=500
//end
//created 12,Dec.,2011 by Abcdefgh
//modified 10,Mar.,2012 by Abcdefgh
//modified 11,Sept.,2012 by Abcdefgh
//オリジナルサイズ画像DLに対応
function(){
println('twitter.dms start');
// 画像ページURLをモバイルページURLに変換
var title = urlinfo.url;
title = title.replace(/http:/,"https:");
title = title.replace(/\/twitter[.]com/,"/mobile.twitter.com");
var url = new URL(title);
urlinfo.url = url.url;
headers.host = url.host;
// 画像ページをダウンロード
common_load('download');
var http = download(urlinfo.url);
if(http.responseHeader.code != 200){
return retry('error--->' + http.responseHeader.code);
}
// 画像URLを抽出
if (!http.data.match(/(href|src)=\"([^"]+twimg[.]com\/media\/[^\/"]+)\"/)) {
println('error---> 目的の画像が見つかりません');
exit();
}
var title=RegExp.$2;
var title=title.replace(/https/,"http");
var title=title.replace(/:(small|med|large)/,"");
var title=title + ":orig";
var url = new URL(title);
urlinfo.url = url.url;
headers.host = url.host;
//ファイル名を抽出
if (!title.match(/([^\/:]+):orig$/)) {
println('error---> ファイル名が見つかりません');
exit();
}
Dorothy.fileName = RegExp.$1;
}