Drkcore

18 09 2007 perl Vox Tweet

vx (Vox用のCLI)

vox用のCLIを作った。post用のURIはこんな感じで探した。本当はhttp://www.vox.com/services/atomにGETして返ってきたXMLをパースすんのがいいんだろうけど、これはそのうちやる。今回は直接指定した。

#!/usr/bin/perl

use XML::Atom::Client;
use XML::Atom::Entry;
use Getopt::Long;

# --- configure --- #
my $user = vox_user;
my $password = vox_passwd;
my $title = "'(my memo)";
my $PostURI = posturl;

# --- main --- #

GetOptions ("title=s"   => \$title);
my $content = shift @ARGV;

die "content not found\n" unless $content;

my $api = XML::Atom::Client->new;
$api->username($user);
$api->password($password);

my $entry = XML::Atom::Entry->new;
$entry->title($title);
$entry->content($content);
my $EditURI = $api->createEntry($PostURI, $entry);
print $api->errstr if $api->errstr;

これをvxって名前で保存しておく。以下使用例

$ vx "なんか思いついたことを書くとよさげ"

タイトルを変えたいときには

$ vx -t todo "ビリーでダイエット"

とか。

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021