Created
December 8, 2012 13:40
-
-
Save tanabe/4240303 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var memberId; | |
var ie = WScript.CreateObject('InternetExplorer.Application'); | |
ie.Visible = true; | |
var openURL = function(url, callback) { | |
ie.Navigate(url); | |
while (ie.ReadyState != 4) { | |
WScript.Sleep(200); | |
} | |
var window = ie.Document.parentWindow; | |
callback(window); | |
}; | |
var fetchVoices = function(next) { | |
openURL('http://mixi.jp/list_voice.pl', function(window) { | |
var diaryBody = ''; | |
var $ = window.$j; | |
var voice = $('.archive'); | |
voice.each(function(index, element) { | |
var postedTime = $(element).find('.postTime').val(); | |
var matches = postedTime.match(/^(\d{4})(\d{2})(\d{2})/); | |
var year = matches[1]; | |
var month = matches[2]; | |
var day = matches[3]; | |
var body = $(element).find('.voiced p').clone().children().remove().end().text(); | |
diaryBody += [year, '/', month, '/', day, ' : ', body, "\n"].join(''); | |
}); | |
memberId = $('.memberId').val(); | |
next(diaryBody); | |
}); | |
}; | |
var writeDiary = function(diaryBody) { | |
openURL('http://mixi.jp/add_diary.pl?id=' + memberId, function(window) { | |
var $ = window.$j; | |
$('.JS_diaryBody').val(diaryBody); | |
}); | |
}; | |
fetchVoices(writeDiary); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment