handle posts without media_content
This commit is contained in:
parent
cea73a38d6
commit
3297ab7c70
|
@ -21,7 +21,7 @@ dr = False
|
|||
@click.option('--prime', is_flag=True)
|
||||
@click.option('--debug', is_flag=True)
|
||||
@click.option('--dryrun', is_flag=True)
|
||||
@click.version_option(version='0.2.1')
|
||||
@click.version_option(version='0.2.2')
|
||||
def main(ctx, db, prime, debug, dryrun):
|
||||
global dr
|
||||
|
||||
|
@ -138,9 +138,10 @@ def pnutpost(entry, source, token):
|
|||
}
|
||||
}
|
||||
raw = [crosspost]
|
||||
for media in entry.media_content:
|
||||
if media["medium"] == "image":
|
||||
raw.append(embed_image(media["url"]))
|
||||
if hasattr(entry, 'media_content'):
|
||||
for media in entry.media_content:
|
||||
if media["medium"] == "image":
|
||||
raw.append(embed_image(media["url"]))
|
||||
|
||||
try:
|
||||
rx = re.compile('<.*?>')
|
||||
|
|
Loading…
Reference in New Issue