最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

记录 wordpress折腾过程

WordPress crifan 3851浏览 0评论

1. 参考:

http://abeltribe.blog.163.com/blog/static/126452923201101684655622/

http://wpchina.org/transfer-blogbus-to-wordpress-quickly-739/

去注册了个blogbus的博客,然后把一个百度空间导入到blogbus里面,然后导出对应的xml文件:

backup-20111207133923.xml

接着用bus2wp.py转换为wordpress可以识别的xml文件:

wp-baidu_music.xml

然后进入wordpress里面:

工具->导入->WordPress,选择刚才的xml,然后点击上传文件并导入,但是出错:

This does not appear to be a WXR file, missing/invalid WX

参考:百度快照,自己手动在xml里面:

<?xml version=”1.0″ encoding=”utf-8″?>

之后,
<rss version=”2.0″ xmlns:content=”http://purl.org/rss/1.0/modules/content/” xmlns:dc=”http://purl.org/dc/elements/1.1/” xmlns:excerpt=”http://wordpress.org/export/1.0/excerpt/” xmlns:wfw=”http://wellformedweb.org/CommentAPI/” xmlns:wp=”http://wordpress.org/export/1.0/“>
之前,添加了对应的

<wp:wxr_version>1.0</wp:wxr_version>
然后再尝试去导入,结果也还是failed,无法导入这些文章。

 

2. 关于将百度空间内容搬到wordpress中,也可以参考这里:

http://www.wodidai.com/post/baidu-hi-wordpress.html

介绍的,先用blog_backup存为rss,然后改一下关键字,再导入wordpress中去。

但是缺点是没法保留评论。

另外,参考:

http://blog.cnfol.com/c9u9f3p1b9/article/36267664.html

去执行使用BlogMover:

hi-baidu-mover.py -s http://hi.baidu.com/recommend_music/blog
发现是可以生成xml文件,但是却只导出了最新一个帖子,其他帖子都没导出来,不过好像是可以到处评论的,只是暂时(如果某文章评论太多,有好多页的话)只支持导出第一页的评论。

所以还是没法实现目的:不仅要实现将百度博客搬家到wordpress,同时也保留全部的评论。

后来无意间找到:

百度搜索“百度空间 wordpress yhustc”可以找到:

新版本的百度空间到wordpress搬家工具

http://www.yhustc.com/%E6%96%B0%E7%89%88%E6%9C%AC%E7%9A%84%E7%99%BE%E5%BA%A6%E7%A9%BA%E9%97%B4%E5%88%B0wordpress%E6%90%AC%E5%AE%B6%E5%B7%A5%E5%85%B7.html

中的新版本的工具:

hi-baidu-mover_v2.zip

有空可以试试。

 

想要学习如何写python脚本解析网页,其中关于BeautifulSoup可以参考这里:

http://www.crummy.com/software/BeautifulSoup/documentation.zh.html

 

关于百度空间页面html源码的解析,可以参考这个:

从百度空间到CSDN——博客搬家源码

http://lvliangtest.blog.163.com/blog/static/17392912320101049583632/

 

 这里:

http://www.yhustc.com/%E5%8F%91%E5%B8%83wordpress%E6%90%AC%E5%AE%B6%E5%B7%A5%E5%85%B7.html

已经解释了,上面那些网易博客搬家的代码失效了,但是其发布了一个新版本的百度空间搬家的代码,就是上面提到的

新版本的百度空间到wordpress搬家工具

http://www.yhustc.com/%E6%96%B0%E7%89%88%E6%9C%AC%E7%9A%84%E7%99%BE%E5%BA%A6%E7%A9%BA%E9%97%B4%E5%88%B0wordpress%E6%90%AC%E5%AE%B6%E5%B7%A5%E5%85%B7.html

只是经过尝试,目前此刻,2011-12-09,也是失效的,也是无法下载百度空间日志的。

及时加上了-f 最新一个日志地址,也还是只能下载单个日志,不能正常地搬家全部帖子。

所以,看来还是要自己抽空写出来一个有效的搬家的脚步才行。

 

发现了,最原始的msn的live space搬家的python脚本,是在这里的:

http://live-space-mover.googlecode.com/svn-history/r40/trunk/live-space-mover.py

而上面那个BlogMover,应该就是以其为基础,修改添加了多个针对百度,网易等的新版本。

而且,又发现了,该脚本,在google code上有:

http://code.google.com/p/live-space-mover/downloads/list

截止目前(2011-12-11)最新版本是2010年7月的live-space-mover.1.8.zip

其中可以找到这里:

http://b2.broom9.com/?page_id=519

里面介绍了此脚本的来龙去脉和使用方法和注意事项。

其中也有关于UnicodeDecodeError的介绍:

 If you met an “UnicodeDecodeError”, that’s probably because your live space contains Italian or other languages. There is a bug in Python 2.5, you need to fix it. Yes, fix Python library by your own hands 😛
If you installed Python to it’s default path on Windows, what you need to do is to change the file C:Python25Libsgmlib.py, in line 394
if not 0 <= n <= 255:
should be changed to
if not 0 <= n <= 127:
That’s all, I learned this from here

   

最后还是自己实现了:

【已实现】想要通过python脚本实现抓取百度空间上的文章,评论,图片 v2011-12-19

3.如果想要尝试去学习bus2wp.py的修正,那么可以先去学习关于rss的spec:

RSS 1.0 spec

http://www.rssboard.org/rss-profile#element-channel

RSS 2.0 spec

http://www.rssboard.org/rss-specification

顺带说一下,关于language一项,常见的是en(英语),和中文的zh-cn,指的是简体中文。对应的zh-tw指的是繁体中文。

想说的是,没有zh这一缩写。

此处摘录几个常见的:

Chinese (Simplified)

zh-cn

Chinese (Traditional)

zh-tw

English

en

French

fr

German

de

Italian

it

Japanese

ja

 更多的语言缩写,参见:

http://www.rssboard.org/rss-language-codes

 

4.关于wordpress里面的语法高亮插件,网上看到这里:

译言网| WordPress代码高亮插件指南

http://article.yeeyan.org/view/119553/94844

评测说这个不错:

http://wordpress.org/extend/plugins/syntax-highlighter-and-code-prettifier/
有机会去试试。 

5.关于wordpress导出的xml文件,全名叫做WordPress eXtended RSS,WXR文件。

其中WXR的格式,有人已经总结的不错了,可以参考一下:

WordPress eXtended Rss (WXR)文件格式解析

http://huxuan.org/20110622/analysis-of-wordpress-extended-rss-wxr-file/

转载请注明:在路上 » 记录 wordpress折腾过程

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (2)

  1. 高手在民间!
    一念花开11年前 (2013-04-21)回复
95 queries in 0.169 seconds, using 22.14MB memory