Browse Source

Don't crash when post has no media (d'Oh)

master
Gitea 1 year ago
parent
commit
af97f570ab
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      mymastotag.py

+ 1
- 1
mymastotag.py View File

27
         e['description'] = str(soup)
27
         e['description'] = str(soup)
28
         images = []
28
         images = []
29
         videos =[]
29
         videos =[]
30
-        for m in e['media_content']:
30
+        for m in e.get('media_content', []):
31
             mtype = m['type'].split('/')[0]
31
             mtype = m['type'].split('/')[0]
32
             if mtype=='image':
32
             if mtype=='image':
33
                 images.append(m)
33
                 images.append(m)

Loading…
Cancel
Save