1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
| #!/usr/bin/env groovy
@Grab("org.apache.xmlrpc:xmlrpc-client:*")
import org.apache.xmlrpc.client.*
XmlRpcClient client = new XmlRpcClient(
config : new XmlRpcClientConfigImpl(
serverURL:new URL("http://blog.fc2.com/xmlrpc.php"),
),
)
def userId = "てきとうなユーザーIDにかえてください"
def password = "てきとうなパスワードにかえてください"
def params = [
// blogId
"",
userId,
password,
[
"title":"タイトルです",
"description":"本文です",
// 本文中の改行をbrタグで反映
"mt_convert_breaks":true,
// コメントを受け付けるか
"mt_allow_comments":true,
// トラックバックを受け付けるか
"mt_allow_pings":true,
"mt_text_more":"続きを読むの部分です",
],
// publish(trueで公開, falseで下書)
true,
]
def result = client.execute("metaWeblog.newPost", params as Object[])
// 新規投稿した記事番号が返る
println "記事番号:" + result + "です。"
|