1
0
Fork 0
forked from github/pelican

force timestamp conversion in tumblr importer to be UTC with offset and adjust tests

This commit is contained in:
Deniz Turgut 2023-10-28 15:55:02 +03:00
commit 83a8059d02
No known key found for this signature in database
GPG key ID: 87B7168D7AB3ED2F
2 changed files with 13 additions and 16 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python
import argparse
import datetime
import logging
import os
import re
@ -416,10 +417,12 @@ def tumblr2fields(api_key, blogname):
slug = post.get('slug') or slugify(title, regex_subs=subs)
tags = post.get('tags')
timestamp = post.get('timestamp')
date = SafeDatetime.fromtimestamp(int(timestamp)).strftime(
"%Y-%m-%d %H:%M:%S")
slug = SafeDatetime.fromtimestamp(int(timestamp)).strftime(
"%Y-%m-%d-") + slug
date = SafeDatetime.fromtimestamp(
int(timestamp), tz=datetime.timezone.utc
).strftime("%Y-%m-%d %H:%M:%S%z")
slug = SafeDatetime.fromtimestamp(
int(timestamp), tz=datetime.timezone.utc
).strftime("%Y-%m-%d-") + slug
format = post.get('format')
content = post.get('body')
type = post.get('type')