From deebda5596d88969e5c078a9d87278bfa9829124 Mon Sep 17 00:00:00 2001 From: Will Thong Date: Mon, 21 Aug 2023 16:45:25 +0100 Subject: [PATCH] Fix orphaned embedded video links from Tumblr. Fix #3177 --- RELEASE.md | 3 +++ pelican/tools/pelican_import.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..028437db --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,3 @@ +Release type: minor + +Add exception to deal with broken embedded video links when importing from Tumblr. diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 7833ebbe..abd7949a 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -499,8 +499,11 @@ def tumblr2fields(api_key, blogname): fmtstr = '

via

\n' source = fmtstr % post.get('source_url') caption = post.get('caption') - players = '\n'.join(player.get('embed_code') - for player in post.get('player')) + try: + players = '\n'.join(player.get('embed_code') + for player in post.get('player')) + except TypeError: + players = '\n' content = source + caption + players elif type == 'answer': title = post.get('question')