motemen/adsense-report-cli · GitHub
ä¾ã«ãã£ã¦ go get github.com/motemen/adsense-report-cli
ã§ã¤ã³ã¹ãã¼ã«ã§ãã¾ãã
使ç¨ä¾
ããã©ã«ãã§ãç´è¿ 7 æ¥éã®æ¥æ¯ã®åå ¥ã表示ãã¾ãã
% adsense-report-cli DATE EARNINGS (JPY) 2014-07-01 1 2014-07-02 0 2014-07-03 2 2014-07-04 0 2014-07-05 0 2014-07-06 1 2014-07-07 0
ï¼æ°åã¯ãµã³ãã«ã§ãï¼
dimension, metric ãªã©ã®ãã©ã¡ã¼ã¿ãæå®ãããã¨ã§ãèªç±ã«ç¥ãããæ å ±ãåå¾ãããã¨ãã§ãããdimension 㨠metric ã«ã¤ãã¦ã¯ Metrics and Dimensions - AdSense Management API — Google Developersãæ¥ä»ã®æå®æ¹æ³ã«ã¤ãã¦ã¯ Using Relative Date Keywords - AdSense Management API — Google Developers ãè¦ãã¨ããã«åããã¨æãã¾ãã
% adsense-report-cli -dimension=MONTH -metric=PAGE_VIEWS -from=startOfMonth-3m -to=today MONTH PAGE_VIEWS 2014-04 500 2014-05 500 2014-06 1000 2014-07 300
ï¼æ°åã¯ãµã³ãã«ã§ãï¼
åæºå
Google ã® API ã使ãã®ã§ãOAuth èªè¨¼ã®ããã« https://console.developers.google.com ããããã¸ã§ã¯ããç»é²ãããã¾ããã®éã
- "APIS & Auth" > "APIs" ãã "Adsense Management API" ãæå¹ã«ãã
- "APIS & Auth" > "Credentials" > "OAuth" > "Create new Client ID" ãã "Web Application" ãç»é²ããRedirect URI ã¨ãã¦
"http://127.0.0.1"
ãç»é²ãã - ç»é²ããã¢ããªã«ã¤ã㦠"Download JSON" ãã client_secret_XXXXX.json ããã¦ã³ãã¼ããã
~/.adsense-report-cli/client_secret.json
ã«ç½®ã
å¿ è¦ãããã¾ãããã¨ã¯ååèµ·å㧠OAuth èªè¨¼ããã ãã大å¤ã ãã©ããã°ã£ã¦ï¼
å¿ç¨ä¾: tmux ã®ã¹ãã¼ã¿ã¹ãã¼ã«ä»æ¥ã®åå ¥ã表示ãã
誰ã ã£ã¦èªåã®åå ¥ã¯æ°ã«ãªããã®ãã¹ãã¼ã¿ã¹ãã¼ã«åå ¥ã表示ãã¦ãèªç¶ã¨ç®ã«å ¥ãããã«ãã¦ã¿ã¦ã¯ï¼
以ä¸ã®ã¹ã¯ãªããã¨è¨å®ã§è¡¨ç¤ºãã¦ã¿ãä¾ã§ããããã便å©
ï¼æ°åã¯ãµã³ãã«ã§ãï¼
# ~/.tmux.conf set-window-option -g status-right "#[fg=green]#(adsense-todays-earnings)#[default] | %Y-%m-%d(%a) %H:%M:%S"
Show today's AdSense earnings using https://github ...
Known issues
- è¤æ°ã® dimension, metric ã«å¯¾å¿ãã¦ããªã
- gogole-api-go-client ã®å¶éã§ãã
- è¤æ°ã¢ã«ã¦ã³ãã«å¯¾å¿ãã¦ããªã
- ãã¨ããæ°ã¥ããã®ã§ãã£ã¦ãªããã¡ãã£ã¨æ¸ããããã対å¿ã§ãããã