티스토리 뷰
티스토리에 계정 만든지 꽤 시간이 지났지만...
블로그 쓴지도 꽤 오래됐고... (나 혼자쓰는) 모니위키 블로그 플러그인 코드 손 안본지도 오래됐고... 아무도 안 봐주는 블로그의 한계도 절감하고 있고...
아무튼 이런 저런 이유로 블로그도 잘 안쓰게 되고...
어제 자바로 한 20줄 정도 코딩해서 모니 블로그를 티스토리로 옮겼다.
쪽 팔리는 코드지만... -,.-;;;; (이젠 정말 없겠지만) 모니블로그 쓰시는 분들께... 모니블로그 개발자로써 최소한의 애프터서비스랄까... 링크나 태그들까지 정리할려고 했는데... 너무 귀찮아서 이 정도로 양해해주시길...
블로그 쓴지도 꽤 오래됐고... (나 혼자쓰는) 모니위키 블로그 플러그인 코드 손 안본지도 오래됐고... 아무도 안 봐주는 블로그의 한계도 절감하고 있고...
아무튼 이런 저런 이유로 블로그도 잘 안쓰게 되고...
어제 자바로 한 20줄 정도 코딩해서 모니 블로그를 티스토리로 옮겼다.
쪽 팔리는 코드지만... -,.-;;;; (이젠 정말 없겠지만) 모니블로그 쓰시는 분들께... 모니블로그 개발자로써 최소한의 애프터서비스랄까... 링크나 태그들까지 정리할려고 했는데... 너무 귀찮아서 이 정도로 양해해주시길...
import java.io.File;
import java.io.PrintWriter;
import java.net.URL;
import java.util.StringTokenizer;
import org.jdom.Document;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
public class MoniBlogToTatterTools {
private static final String URL_PREFIX = "http://hellocity.net/~iolo/wiki/";
private static final String URL_SUFFIX = "?action=blogrss";
private static final String[] BLOG_PAGE_NAMES = { "AimationBlog", "BookBlog", "GameBlog", 여기에 블로그 페이지 이름들을 나열... };
private static final int AUTHOR = 티스토리의 Blog API Blog ID;
private static final String HEADER = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><blog...태터의 XML backup파일에서 첫번째 <post>태그 앞에 있는 내용";
private static final String FOOTER = "태터의 XML backup파일에서 마지막 <post>태그 뒤에 있는 내용...</blog>";
public static void main(String[] args) throws Exception {
PrintWriter out = new PrintWriter(new File("/tmp/mb2tt.xml"), "UTF-8");
out.println(HEADER);
int id = 0;
for (String blogPageName : BLOG_PAGE_NAMES) {
SyndFeed feed = null;
try {
URL url = new URL(URL_PREFIX + blogPageName + URL_SUFFIX);
SyndFeedInput input = new SyndFeedInput();
Document doc = new org.jdom.input.SAXBuilder().build(url.openStream());
feed = input.build(doc);
} catch (Exception e) {
System.err.println("invalid feed! feed=" + feed);
e.printStackTrace(System.err);
continue;
}
SyndEntry entry = null;
for (Object _entry : feed.getEntries()) {
try {
entry = (SyndEntry) _entry;
String slogan = htmlSpecialChars(entry.getTitle());
String format = "1.1";
String domain = "tistory";
int author = AUTHOR;
++id;
String visibility = "private";
String title = slogan;
String content = htmlSpecialChars(entry.getDescription()
.getValue());
String location = "/";
String password = "";
int acceptComment = 1;
int acceptTrackback = 1;
int published = (int) (entry.getPublishedDate().getTime() / 1000);
int created = published;
int modified = published;
String category;
if (blogPageName.indexOf('/') > 0) {
category = blogPageName.substring(0,blogPageName.indexOf('/')).toLowerCase();
} else {
category = blogPageName.toLowerCase();
}
if (category.endsWith("blog")) {
category = category.substring(0, category.length() - 4);
}
out.println("<post slogan=\"" + slogan + "\" format=\"" + format + "\">");
out.println("<author domain=\"" + domain + "\">" + author + "</author>");
out.println("<id>" + id + "</id>");
out.println("<visibility>" + visibility + "</visibility>");
out.println("<title>" + title + "</title>");
out.println("<content>" + content + "</content>");
out.println("<location>" + location + "</location>");
out.println("<password>" + password + "</password>");
out.println("<acceptComment>" + acceptComment + "</acceptComment>");
out.println("<acceptTrackback>" + acceptTrackback + "</acceptTrackback>");
out.println("<published>" + published + "</published>");
out.println("<created>" + created + "</created>");
out.println("<modified>" + modified + "</modified>");
out.println("<category>" + category + "</category>");
out.println("</post>");
} catch (Exception e) {
System.err.println("invalid entry! entry=" + entry);
e.printStackTrace(System.err);
continue;
}
}
}
out.println(FOOTER);
out.flush();
}
}
'life' 카테고리의 다른 글
내 이름 어때? (2) | 2008.05.27 |
---|---|
창의적, 예술적인 아방가르드 취향 (3) | 2008.03.01 |
빵쩜... (0) | 2007.01.21 |
pale blue dot... (0) | 2007.01.17 |
티스토리 포기-.-; (0) | 2007.01.03 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- JavaScript
- 책
- jQuery
- webapp
- 영화
- Eclipse
- ***1/2
- Ajax
- 독후감
- ****
- 여행
- HTML5
- 자바스크립트
- 땅끝마을
- 해남
- ***
- web
- maven
- 자전거
- **
- docker
- DeveloperWorks
- Prototype
- 노래
- CSS
- nodejs
- Dojo
- Java
- 장필순
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함