Open RomeSilvanus opened 7 years ago
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 could this be helpful? https://github.com/pabluk/tumblr-theme-parser
@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.
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.
@Cebtenzzre could you make a patch to save stuff from my findings?
@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.
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.
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.