将Blogger XML文件转换为Wordpress WXR - 创建Python转换脚本

时间:2021-09-04 07:14:13

I'm currently trying to migrate my Blogger site over onto Wordpress; however, the XML file is too large to use as standard with the Blogger Importer Tool provided as a Wordpress Plugin.

我目前正在尝试将我的Blogger网站迁移到Wordpress上;但是,XML文件太大,无法作为Wordpress插件提供的Blogger Importer Tool标准使用。

Therefore I'm trying to use the WXRsplit program to split the file into more manageable chunks. However I can't seem to find anywhere that I'm able to convert from XML to WXR. The only site everyone is recommending, http://bloggerwordpress1.appspot.com/, is currently down with no notice as to when it might be next up, if at all.

因此,我正在尝试使用WXRsplit程序将文件拆分为更易于管理的块。但是,我似乎无法找到任何可以从XML转换为WXR的地方。每个人都推荐的唯一网站http://bloggerwordpress1.appspot.com/目前正在关闭,如果可能的话,它可能会在下一次发布时没有通知。

If anyone knows how to make this conversion I would really appreciate the help.

如果有人知道如何进行这种转换,我真的很感激帮助。


Edit:

https://code.google.com/p/google-blog-converters-appengine/

So I have found this, which is apparently the codebase for the same site which I noted above that is currently down. However, I have no idea how Python works.

所以我发现了这个,这显然是我上面提到的同一站点的代码库,目前已经关闭了。但是,我不知道Python是如何工作的。

I do however have my own AWS server, running Linux Ubuntu 14.0 LTS, which I have full access to. I am currently trying to get my head around how to run these scripts but I'm having no luck as of yet; so, again, any help is apprectiated!

我有自己的AWS服务器,运行Linux Ubuntu 14.0 LTS,我有完全访问权限。我目前正试图了解如何运行这些脚本,但我还没有运气;所以,再一次,任何帮助都是值得赞赏的!

Thanks.


Edit 2:

So these are the two possibilities I've found so far that appear to produce any sort of result or error I can work from. I'm providing them here just to give more understanding to people looking at a glance who may not have used this particular program, but may gain some idea of what I'm doing wrong!

所以这些是我迄今为止发现的两种可能性,它们似乎会产生任何可以解决的结果或错误。我在这里提供它们只是为了让人们更加了解那些可能没有使用过这个特定程序的人,但可能会对我做错了什么有所了解!

ubuntu@ip-:/var/www/html/pythonconversion/bin$ python blogger2wordpress.sh
  File "blogger2wordpress.sh", line 12
    PROJ_DIR=`dirname $0`/..
                      ^
SyntaxError: invalid syntax


ubuntu@ip-:/var/www/html/pythonconversion/src/blogger2wordpress$ python b2wp.py
Traceback (most recent call last):
  File "b2wp.py", line 28, in <module>
    import wordpress
  File "/var/www/html/pythonconversion/src/blogger2wordpress/wordpress.py", line 55, in <module>
    element_tree_write = ElementTree.ElementTree._write
AttributeError: type object 'ElementTree' has no attribute '_write'

I'm not sure if I'm supposed to run the first or second command in order to try and get the script to execute. As I say, I'm 100% new to python and trying to piece together what little documentation I can find on this.

我不确定我是否应该运行第一个或第二个命令以尝试让脚本执行。就像我说的那样,我是100%新手的python,并试图拼凑出我能找到的小文档。

1 个解决方案

#1


0  

According to this blog, the problem was the script assumes python version 2.5.

根据这个博客,问题是该脚本假设python版本2.5。

Blog Converters are built for Google’s App Engine, they require Python 2.5

博客转换器是为Google的App Engine构建的,它们需要Python 2.5

If you are using mac and don't have python 2.5 installation by default (just like mine on El Captain), take a look at this answer.

如果您使用的是mac并且默认情况下没有安装python 2.5(就像我在El Captain上一样),请看一下这个答案。

On ubuntu, you may wanna use virtualenv.

在ubuntu上,你可能想要使用virtualenv。

#1


0  

According to this blog, the problem was the script assumes python version 2.5.

根据这个博客,问题是该脚本假设python版本2.5。

Blog Converters are built for Google’s App Engine, they require Python 2.5

博客转换器是为Google的App Engine构建的,它们需要Python 2.5

If you are using mac and don't have python 2.5 installation by default (just like mine on El Captain), take a look at this answer.

如果您使用的是mac并且默认情况下没有安装python 2.5(就像我在El Captain上一样),请看一下这个答案。

On ubuntu, you may wanna use virtualenv.

在ubuntu上,你可能想要使用virtualenv。