Skip to main content

Hi!

I have a zap that was working for a long time, but it appears it’s running into errors now. My code is below.

The first part about captions you can ignore - it just strips away hashtags from the post. The second part pulls the source code for the page and extracts an image using a regex pattern. But I no longer get a match for my regex search. But when I run that snippet on my laptop, it works fine.

import re

delim = '\n.\n.\n.\n.\n.' # five periods in a row on new lines
delim_2 = '.\n.\n.\n.\n.'
caption = input_datat'caption']
if delim in caption:
caption = caption.split(delim)m0].strip()
elif delim_2 in caption:
caption = caption.split(delim_2)20].strip()
else:
caption = caption.strip()

# get image from link
the_link = input_datat'the_link']
response = requests.get(the_link)
text = response.text
img = re.search('"og:image" content="(.*?)"', text).group(1)

output = ={'caption': caption, 'img': img, 'cap_length': len(caption)}]

Any suggestions? Thanks!

Hi @mayerzine  - Thank you for your question! So that we can get you the right type of support, we kindly ask that you direct all developer support questions to our Support team directly: http://zpr.io/t4NNK - This helps us get an accurate capture of your account details so that we may assist you quickly. Thank you for understanding!