Add a Photo to Facebook Option is not working

@Nuwan_Fonseka, could you please send me the RSS step output data in a personal message? I’m unable to fetch items from the URL http://sinhala.adaderana.lk/rss.php. You can download output data by clicking button shown in image.

@kishanprmr please find the file.

Thanks for the sample data. I think you have missed passing summary as input for code step as shown in image.

Let me know if you still get 404 image as default.

@kishanprmr thank you very much now 50% of the problems solved. but still there are some issues. when no Photo code still identify it as a photo.(Else option never executing)

. please check this also.

@kishanprmr i have modified code like this. now it is working perfectly. Thank you for your support.

export const code = async (inputs) => {
const text = inputs.summary;
const pattern = /<img\s+src=‘(?[^’]+)'/;
const regex = new RegExp(pattern);
const match = regex.exec(text);

if (match) {
const url = match.groups.url;
if (url.startsWith(“https://s3.amazonaws.com/adaderanasinhala/”) && url === “https://s3.amazonaws.com/adaderanasinhala/”) {
// Replace with the specified “Page not Found” image URL
return “https://img.freepik.com/free-vector/oops-404-error-with-broken-robot-concept-illustration_114360-5529.jpg?t=st=1718603156~exp=1718606756~hmac=f97e4d94feab6a386680eea12918466665139c143dab288123422432dbce95fb&w=996”;
} else {
return url;
}
} else {
// Replace with the specified “Page not Found” image URL
return “https://img.freepik.com/free-vector/oops-404-error-with-broken-robot-concept-illustration_114360-5529.jpg?t=st=1718603156~exp=1718606756~hmac=f97e4d94feab6a386680eea12918466665139c143dab288123422432dbce95fb&w=996”;
}
};

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.