Code Monkey home page Code Monkey logo

tumblr-to-ghost's Introduction

Tumblr to Ghost

This tool takes advantage of the exact format of the exported GhostData.json via the Ugly Debug Tools. It maps your Tumblr blog posts data to this format, creating a file that you can import directly to Ghost. It also creates all your used tags from Tumblr so you can use them later in Ghost. Check out an example export.

Installation

Installing on Heroku is the easiest option. Simply clone the repo, creat an app, and push.

$ heroku create --buildpack https://github.com/ddollar/heroku-buildpack-multi.git
$ git push heroku master
$ heroku config:set PATH=bin:/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin

If you'd like to install locally, first ensure that Pandoc is installed and available.

$ pip install -r requirements.txt
DEBUG=True TUMBLR_API_KEY="<API KEY HERE>" python web.py

tumblr-to-ghost's People

Contributors

abeestrada avatar cobbspur avatar joelw avatar jpadilla avatar simonv3 avatar squidsoup avatar voigt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tumblr-to-ghost's Issues

[Bug] *.json file not importable when duplicate titles in tumblr src

When the tumblr post has multiple posts with title "abc" the export files will generate the same amount of posts - unfortunately do all have the same slug. Ghost will refuse to import *.json files wich contain multiple posts with an identical slug.

Quick fix:
In line 116 assign e.g. the timestamp:

[...]
                'title': title,
                'slug': slug + str(timestamp),
                'markdown': body,
                'html': body,
[...]

Better fix:
a) Create the first slug as before. Increment every next slug.

#1 Post title = "Hello"
slug = "Hello"

#1 Post title = "Hello"
slug = "Hello-2"

#1 Post title = "Hello"
slug = "Hello-3"
[...]

b) Create the first slug as before. Add timestamp to every next slug.

#1 Post title = "Hello"
slug = "Hello"

#1 Post title = "Hello"
slug = "Hello-2015-05-01"

#1 Post title = "Hello"
slug = "Hello-2015-05-04"
[...]

The decision is up to you @jpadilla :)

tags not imported correctly

Scenario:

Tumblr entry #1 has tags:
#a, #b, #c

Tumblr entry #2 has tags:
#a, #b, #d

After exporting posts are created with following tags:

Ghost post #1 has tags:
#c

Ghost post #2 has tags:
#a, #b, #d

=> Every tag is only assgined to a single post.

This leads to following tag overview:

current

This is how this certain overview should look like (with a correct tag assignment):
should be

A couple of issues with text import

Great tool, but it has a couple of issues with text import:

  • apostrophes are stripped from the imported text: the titles keep their apostrophes
  • newline (\n) is inserted at every text break of the web-formatted blog, which does not follow the actual text layout of the post

I've also noticed that if I tried to import my blog using the my own domain address it failed, but if I imported it as my_blog_name.tumblr.com it worked just fine. Might be similar reason why a number of people said they couldn't export their blog.

Thanks for all your hard work. (And if I had better working knowledge of python I would've rolled my sleeves up already and posted the code that would sort out the two issues I've found.)

Tumblr API key issue

I'm running the project locally after getting an error on the heroku app, I found that self.get_blog_info() can be causing the error because Tumblr is not authorizing the API call, this is the response {u'meta': {u'status': 401, u'msg': u'Not Authorized'}, u'response': []}

Missing posts_tags

The export created has a list of posts and tags, but no relation between them, so although the posts and tags get imported into Ghost, none of the posts actually have any tags associated with them.

Cannot export

When running this on OS X Mavericks I cannot convert tumblr to ghosts. I only get this stacktrace stating "No such file or directory.":

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/MyPC/Desktop/tg/web.py", line 22, in index
    posts = tumblr_to_ghost.get_posts()
  File "/Users/MyPC/Desktop/tg/tumblr_to_ghost.py", line 70, in get_posts
    return self.create_ghost_export(posts)
  File "/Users/MyPC/Desktop/tg/tumblr_to_ghost.py", line 92, in create_ghost_export
    "markdown": doc.markdown,
  File "/Users/MyPC/Desktop/tg/src/pyandoc-master/pandoc/core.py", line 65, in <lambda>
    (lambda x, fmt=fmt: cls._output(x, fmt)), # fget
  File "/Users/MyPC/Desktop/tg/src/pyandoc-master/pandoc/core.py", line 82, in _output
    stdout=subprocess.PIPE
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__
    errread, errwrite)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.