tumblr-utils icon indicating copy to clipboard operation
tumblr-utils copied to clipboard

Tumblr theme

Open RomeSilvanus opened this issue 7 years ago • 7 comments

Are there any plans of actually saving and using the Layout/Theme (the html) as it appears on the Tumblr blog. Instead of using the standard html that comes with your application?

It would be a nice feature to have the backed up blog look exactly the same as the original.

RomeSilvanus avatar Jun 04 '17 15:06 RomeSilvanus

AFAIK, there's no API to get the HTML template code which would be needed for this. But if you find a different way, you're welcome to send a pull request!

bbolli avatar Jun 05 '17 11:06 bbolli

@bbolli could this be helpful? https://github.com/pabluk/tumblr-theme-parser

gacallea avatar Dec 07 '17 14:12 gacallea

@bbolli www.tumblr.com/customize_api/demo_content/{blog-identifier} is an internal API which seems to return the theme configuration in JSON format. This appears to work for any blog and only requires the cookies of any logged-in user.

Example for my blog teamawe5ome5inceweareawe5omene55.tumblr.com : https://www.tumblr.com/customize_api/demo_content/teamawe5ome5inceweareawe5omene55

www.tumblr.com/customize_api/theme/{blog-identifier} also exists, and might return the theme template code. However, it tells me my request was denied when I try to just request it without any special headers, so I'm not sure. I'll try and figure out how to access it.

wertercatt avatar Dec 09 '18 19:12 wertercatt

https://www.tumblr.com/customize_api/blog/{blog-identifier} This internal api gets the theme config and the custom theme code! ...but it requires the cookies of a logged-in user and will deny requests for blogs the user isn't part of.

wertercatt avatar Dec 09 '18 20:12 wertercatt

@Cebtenzzre could you make a patch to save stuff from my findings?

wertercatt avatar Dec 14 '18 17:12 wertercatt

@wertercatt Well, there is some theme data in there. But I don't know how you would get a proper CSS stylesheet from it that could be used to change the look of the HTML archive tumblr-utils creates.

I've managed to find a consistent style.css in the HTML, but I haven't yet figured out how to get an XPath expression for xmlstarlet working in Python, and I don't know what I'd do with the stylesheet once it's been retrieved. I suppose it could be saved separately "for future/external usage" in the same way we save JSON payloads.

Do you really just want to save the HTTP responses from those URLs? Because if you want to do that, all you need is curl. Just pass it some cookies and headers and stuff via the command line. I don't see why tumblr-utils should download that, since as far as I understand it's not useful to have locally.

cebtenzzre avatar Dec 14 '18 18:12 cebtenzzre

So if you want a mirror of your blog pages, you can use any web site scraper that supports cookies. Even wget would work for this with the right options. tumblr_backup is not a scraper, in that it backs up your posts with metadata if you also save the JSON.

bbolli avatar Dec 14 '18 21:12 bbolli