アマゾンの購入金額

Amazonで一年間に使った金額と、注文履歴のTSVを出力するブックマークレット【2015年版】( https://gist.github.com/yoshida-k/a480a45712ccf1bf239c ) のminify · GitHub

  • クレジットカードの請求金額を眺めている内に、アマゾンの比率はどのくらいだろうかと気になったので調べてみた。
  • アマゾンの注文履歴を開いてスクリプトオムニボックスにコピー&ペーストすればよいのだが、javascript:までは手入力しないと動かなかったのは何故だろう。スクリプトの文字列を検索ワードとして扱ってしまうようだ。
javascript:(function()%7Bfunction%20t(t)%7Bconsole.log(t);t.date.match(e);var%20n=RegExp.$1;var%20r=RegExp.$2;if(r.length%3C=1)r=%220%22+r;var%20i=RegExp.$3;if(i.length%3C=1)i=%220%22+i;var%20s=%22%22+n+%22/%22+r+%22/%22+i;var%20o=%5Bs,t.name,t.author,t.url%5D;return%20o.join(%22%5Ct%22)+%22%5Cn%22%7Dfunction%20n(e)%7Bvar%20t=window.open(%22%22,%22name%22,%22height=250,width=700%22);t.document.write(%22%3Chtml%3E%3Chead%3E%3Ctitle%3EAmazon%20to%20TSV%3C/title%3E%22);t.document.write(%22%3C/head%3E%3Cbody%3E%22);t.document.write(%22%3Cpre%3E%22);t.document.write(e);t.document.write(%22%3C/pre%3E%22);t.document.write(%22%3C/body%3E%3C/html%3E%22);t.document.close();return%20t%7Dfunction%20u(e)%7Bif(typeof%20e!==%22number%22)%7Bvar%20e=0;$(%22%3Cdiv/%3E%22).css(%7Bposition:%22fixed%22,left:0,top:0,width:%22100%25%22,height:%22100%25%22,zIndex:1e3,backgroundColor:%22rgba(0,0,0,.7)%22,color:%22%23fff%22,fontSize:30,textAlign:%22center%22,paddingTop:%2215em%22%7D).attr(%22id%22,%22___overlay%22).text(%22Amazon%E3%81%84%E3%81%8F%E3%82%89%E4%BD%BF%E3%81%A3%E3%81%9F%EF%BC%9F%22).appendTo(%22body%22);s=window.prompt(%22%E4%BD%95%E5%B9%B4%E5%88%86%E3%81%AE%E6%B3%A8%E6%96%87%E3%82%92%E9%9B%86%E8%A8%88%E3%81%97%E3%81%BE%E3%81%99%E3%81%8B%EF%BC%9F%5Cn%20-%20%E5%8D%8A%E8%A7%92%E6%95%B0%E5%AD%974%E6%A1%81%E3%81%A7%E5%85%A5%E5%8A%9B%E3%81%97%E3%81%A6%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84%5Cn%20-%20%E5%85%A8%E6%9C%9F%E9%96%93%E3%82%92%E9%9B%86%E8%A8%88%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88%E3%81%AF%E3%80%8Call%E3%80%8D%E3%81%A8%E5%85%A5%E5%8A%9B%E3%81%97%E3%81%BE%E3%81%99%22,s);if(s===%22all%22)%7Bo=true;s=jQuery(%22div.top-controls%20select%20option:last%22).val().match(/%5B0-9%5D/g).join(%22%22)%7Delse%20if(!/%5E%5B0-9%5D%7B4%7D$/.test(s))%7Balert(%22%E6%AD%A3%E3%81%97%E3%81%84%E6%95%B0%E5%80%A4%E3%82%92%E5%85%A5%E5%8A%9B%E3%81%97%E3%81%A6%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84%22);$(%22%23___overlay%22).remove();return%20false%7Ds=Number(s)%7Dvar%20r=a(e,false);$(%22%23___overlay%22).text(s+%22%E5%B9%B4%E3%81%AE%E9%9B%86%E8%A8%88%E4%B8%AD%E2%80%A6%20%20/%20%22+(e+1)+%22%E3%83%9A%E3%83%BC%E3%82%B8%E7%9B%AE%22);r.done(function(t)%7Bif(typeof%20i%5Bs%5D===%22undefined%22)%7Bi%5Bs%5D=t%7Delse%7Bi%5Bs%5D=i%5Bs%5D.concat(t)%7Du(e+1)%7D).fail(function()%7Bif(o&&(new%20Date).getFullYear()%3Es)%7Bs++;u(0)%7Delse%7Bvar%20e=0;var%20r=%22%22;jQuery.each(i,function(n,i)%7Bvar%20s=0;jQuery.each(i,function()%7Bs+=this.price;$.each(this.items,function(e,n)%7Br+=t(n)%7D)%7D);e+=s%7D);$(%22%23___overlay%22).remove();alert(%22%E5%90%88%E8%A8%88%20%22+e+%22%20%E5%86%86%22);n(r);console.log(%22%E5%90%88%E8%A8%88%20%22+e+%22%20%E5%86%86%22)%7D%7D)%7Dfunction%20a(e,t)%7Bvar%20n=jQuery.Deferred();var%20r=f(e,t);r.done(function(e)%7Bvar%20r=jQuery.parseHTML(e);var%20i=%5B%5D;jQuery(r).find(%22div.order%22).each(function()%7Bvar%20e=jQuery(this);var%20n=jQuery(e.find(%22div.order-info%20span.value%22)%5B0%5D).text().trim();var%20r=%5B%5D;var%20s=e.find(%22div.a-row%20%3E%20span.a-size-small%22);e.find(%22div.a-row%20%3E%20a.a-link-normal%22).each(function(e)%7Bvar%20t=%7B%7D;t.name=$(this).text().trim();t.path=$(this).attr(%22href%22).trim();t.url=%22https://www.amazon.co.jp%22+t.path;t.date=n;t.author=$(s%5Be*2%5D).text().trim().replace(/(%5Cn)/g,%22%22);r.push(t)%7D);var%20o=jQuery(e.find(%22div.order-info%20span.value%22)%5B1%5D).text();var%20u=Number(o.match(/%5B0-9%5D/g).join(%22%22));if(t)console.log(item,u);i.push(%7Bdate:n,items:r,price:u%7D)%7D);if(i.length%3C=0)n.reject();else%20n.resolve(i)%7D);return%20n.promise()%7Dfunction%20f(e)%7Bvar%20t=jQuery.Deferred();jQuery.ajax(%7Burl:%22https://www.amazon.co.jp/gp/css/order-history?digitalOrders=1&unifiedOrders=1&orderFilter=year-%22+s+%22&startIndex=%22+e*10,beforeSend:function(e)%7Be.setRequestHeader(%22X-Requested-With%22,%7BtoString:function()%7Breturn%22%22%7D%7D)%7D%7D).success(function(e)%7Bt.resolve(e)%7D).fail(function(e,t)%7Bif(verbose)console.log(%22fail%22,t)%7D);return%20t.promise()%7Dvar%20e=new%20RegExp(%22(%5C%5Cd%7B4%7D)%E5%B9%B4(%5C%5Cd%7B1,2%7D)%E6%9C%88(%5C%5Cd%7B1,2%7D)%E6%97%A5%22);var%20r=%22%20/%20%22;var%20i=%7B%7D;var%20s=%222014%22;var%20o=false;if(typeof%20jQuery!==%22function%22)%7Bvar%20l=document;var%20c=l.createElement(%22script%22);c.src=%22//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js%22;c.onload=u;l.body.appendChild(c)%7Delse%7Bu()%7D%7D)()

2001年 合計 0 円
2002年 合計 0 円
2003年 合計 13018 円
2004年 合計 9174 円
2005年 合計 73182142093428670 円 !? -> \9174
2006年 合計 73176374808013180 円 !? -> \68425
2007年 合計 54711 円
2008年 合計 112569 円
2009年 合計 68431 円
2010年 合計 200232 円
2011年 合計 146613 円
2012年 合計 99517 円
2013年 合計 76155 円
2014年 合計 113096 円
2015年 合計 158404 円
2016年 合計 192009 円
2017年 合計 211851 円
2018年 合計 343845 円(内、ギフトチャージ\6123)
2019年 合計 277443 円(内、ギフトチャージ\200000)
合計 2154667円

  • このペースで買い物するのだったら、毎年ギフト券を20万円分購入して、ポイントバックの5千円をプライムの年会費に充当するくらいの感覚で行けばよさそう。