ä»»æã®tumblrã®Pictureã ããä¸æ¬ãã¦ã³ãã¼ããã¦ãã¡ãã¡ãã
tumblrã£ã¦ããããããã°ã¨ã¯ãªããã³ã°ã¨ã½ã¼ã·ã£ã«çãªä½ããä¸ç·ã«ãªã£ããããªWebãµã¼ãã¹ã«ããã£ã¦ãããå¤å使ãæ¹ãééã£ã¦ããæ°ããããã©ãåã¯ã2次å çµµãéãã¾ãããã®ã«ä½¿ã£ã¦ããã
éãã¾ããã®ã¯ã¾ãããã¨ãã¦Webã§éå»ãã°ããã©ã¦ã¸ã³ã°ãã¦ãããã®ã¼ã£ã¦è¦ãã®ã£ã¦æéãããããMacã®CoverFlowã¨ãæºå¸¯ã¨ãã§è¦ã¾ãã£ã¦ãã¤ãã®éã®è³å ã¯ã¼ã«ãã«ã¹ã ã¼ãºã«é ãããããã
æãç«ã£ããåæ¥ãä¸æ¬ãã¦ã³ãã¼ãã¹ã¯ãªãããä½ã£ãã
#tumblrã®archiveURL
DOMAIN=http://hogehoge.tumblr.com/archive
ã®URLãä»»æã®tumblrã®ãã¡ã¤ã³ã«æ¸ãæãã¦ä¸æ¸ããMacã ãLinuxã ãã®UNIXã³ã³ã½ã¼ã«ä¸ã§ãã¦ã³ãã¼ãããã¹ã¯ãªããã¨åããã£ã¬ã¯ããªã§
$ ./tumblrget.sh
ã¨æã¦ã°ãè²ã ãã¡ã¤ã«ãåºæ¥ã¦dataãã©ã«ãã®ä¸ã«ã¬ãã¬ããã¡ã¤ã«ããã¦ã³ãã¼ãããããã¾ãã以åã®ææ°ç»åURLãè¨é²ãã¦ããã®ã§tumblrã«æ°è¦ã§ç»åã追å ããéã«å度ã³ãã³ããæã¦ã°å·®åã ããã¦ã³ãã¼ããã¦ãããã
tumblrã®ç»åURLã®ãã¤ã³ãã¯ãã¦ã³ãã¼ãURLã®æ«å°¾ã500ã«ããã¨é«è§£å度ã®ãã¼ã¿ããã¦ã³ãã¼ãã§ããã¨ãããtumblrã®ç»åã¯è¤æ°è§£å度ãä¿æãã¦ããã®ãåçã«çæãã¦ããã®ãããããªãããURLã®æ«å°¾ãå¼æ°ã«ãã¦XML-RPCã«ãã£ã¦ç»åãè¿å´ãã¦ããããªãXML-RPCã¨æ¨æ¸¬ã§ãããã¨ããã¨500ã¨250以å¤ã®é©å½ãªæ°åãå ¥ããã¨ã¨ã©ã¼ã¡ãã»ã¼ã¸ãXMLã§è¿ã£ã¦ãããããã¨ãããã¨ã¯ãåçã«çæãã¦ããã®ããªãã§ãããã«ãã¦ã¯è¿å´ãããã¹ãã¼ããçµæ§éãããããããããã¼ããåæ£ãã¦æ ¼ç´ãã¦ããç»åãå¼ã³åºãã®ã«ä½¿ã£ã¦ããã®ãããããªãã
æ«å°¾ã«ã½ã¼ã¹ãæ·»ä»ãã¦ãããééããã£ãã誰ãæãã¦ã¯ã¬ã¯ã¬åã
tumblrget.shï¼ã¿ã³ãã©ã¼ãã´ãªã´ãªãã¦ã³ãã¼ãããã·ã§ã«ã¹ã¯ãªãã
#!/bin/bash# archive :wgetãããã³ãã©ãªãã¼ã¿
# resenturl.txt :åéæ¸ã¿ç´è¿ã®ç»åURL
# regeturl.txt :ä»ååå¾ããç»åURLãªã¹ã
# geturl.txt :ç´è¿ã§åå¾ããç»åãªã¹ãpx200ç
# geturl500.txt :ç´è¿ã§åå¾ããç»åãªã¹ãpx500ç#tumblrã®archiveURL
DOMAIN=http://hogehoge.tumblr.com/archive#åéæ¸ã¿ç´è¿ã®ç»åURL
VARURL=`head -1 resenturl.txt`#ææ°imgURLãªã¹ãåå¾
rm -rf geturl.txt
rm -rf archive
echo "get archive list."
wget -nv $DOMAIN
grep background\:url archive | awk -F \' '{print $2}' > regeturl.txt#æ´æ°ããªããã°çµäº
if [ `head -1 regeturl.txt` = "$VARURL" ]; then
echo "tumblr nochanged."
exit
fi#åéæ¸ã¿URL以éã®URLãæã
while read line
do
if [ "$line" = "$VARURL" ]; then
break
fi
echo $line >> geturl.txt
done < regeturl.txt#ææ°URLãæ¸ãæã/ææ°URLæ´æ°/大ç»åãªã¹ãåå¾
echo "tumblr added "`cat geturl.txt |wc -l`" pictures."
head -1 geturl.txt > resenturl.txt
sed "s/_250/_500/" geturl.txt > geturl500.txtecho "get archive..."
wget -i geturl500.txt -P ./data/
echo "got. ended."