Open kafuku1 opened 5 years ago
I'm running into the same issue.
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/bin/tumblr_backup.py", line 1043, in handler
work()
File "/usr/local/bin/tumblr_backup.py", line 735, in save_content
append(post['player'][-1]['embed_code'])
KeyError: 'player'
I installed by cloning the repo and copying the python script to my /usr/local/bin
and then ran tumblr_backup.py blogname
. I didn't run with any special flags and I brew installed both youtube-dl
and pyexiv2
locally.
Here's an untested patch that attempts to make the video/audio save/embed code more robust. I don't know Python as well as I know C++, so standard disclaimer if it doesn't work.
These instructions seem to be necessary here: Here is where I've explained how to apply a patch. See also diff on Wikipedia and the man page for GNU patch.
diff --git a/tumblr_backup.py b/tumblr_backup.py
index 338c7d3..c2eb2fe 100755
--- a/tumblr_backup.py
+++ b/tumblr_backup.py
@@ -731,13 +731,17 @@ class TumblrPost:
src, "Your browser does not support the video element.", src, "Video file"
))
else:
- append(post['player'][-1]['embed_code'])
+ player = get_try('player')
+ if player:
+ append(player[-1]['embed_code'])
+ else:
+ append_try('video_url')
append_try('caption')
elif self.typ == 'audio':
src = ''
+ audio_url = get_try('audio_url') or get_try('audio_source_url')
if options.save_audio:
- audio_url = get_try('audio_url') or get_try('audio_source_url')
if post['audio_type'] == 'tumblr':
if audio_url.startswith('https://a.tumblr.com/'):
src = self.get_media_url(audio_url, '.mp3')
@@ -746,12 +750,13 @@ class TumblrPost:
src = self.get_media_url(audio_url, '.mp3')
elif post['audio_type'] == 'soundcloud':
src = self.get_media_url(audio_url, '.mp3')
- if src:
+ player = get_try('player')
+ if src or ((not player) and audio_url):
append(u'<p><audio controls><source src="%s" type=audio/mpeg>%s<br>\n<a href="%s">%s</a></audio></p>' % (
- src, "Your browser does not support the audio element.", src, "Audio file"
+ src, "Your browser does not support the audio element.", src or audio_url, "Audio file"
))
- else:
- append(post['player'])
+ elif player:
+ append(player)
append_try('caption')
elif self.typ == 'answer':
@kafuku1 @themcny Is it possible to get the full command that was run (including blog name)? I'd like to try to test @Cebtenzzre's patch, but don't know what specific payloads are causing the problem.
I'm having what looks like the same issue. I used my blog (tumblr_backup.py frogeyedape) if you want to test it.
I'm a total newbie to both python and github, so please let me know if there's any other information I need to add.
I'm having issues with the latest release of the tool. Everytime I run it this error appears. I've looked for the same error but I didn't find any solution.
Exception in thread Thread-14:to 49 of 1679 Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner self.run() File "C:\Python27\lib\threading.py", line 754, in run self.target(*self.args, **self.__kwargs) File "C:\Users\user\Downloads\c\tumblr_backup.py", line 1043, in handler
File "C:\Users\user\Downloads\c\tumblr_backup.py", line 735, in save_con tent append(post['player'][-1]['embed_code']) KeyError: 'player' Exception in thread Thread-9: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner self.run() File "C:\Python27\lib\threading.py", line 754, in run self.target(*self.args, **self.__kwargs) File "C:\Users\user\Downloads\c\tumblr_backup.py", line 1043, in handler
File "C:\Users\user\Downloads\c\tumblr_backup.py", line 735, in save_con tent append(post['player'][-1]['embed_code']) KeyError: 'player'
Exception in thread Thread-17: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner self.run() File "C:\Python27\lib\threading.py", line 754, in run self.target(*self.args, **self.__kwargs) File "C:\Users\user\Downloads\c\tumblr_backup.py", line 1043, in handler
File "C:\Users\user\Downloads\c\tumblr_backup.py", line 735, in save_con tent append(post['player'][-1]['embed_code']) KeyError: 'player'