Build HTTP module (Make) with Code action (Pabbly) ?
Status: Open · Asked by JJJJJJJJJJJ on · 0 views
Hey Guys,
I’m really missing the HTTP module that Make offers, so figured that with a little help of LLMs I could easily build this with the Code action in Pabbly.
Guess not.
Has anyone achieved this, or is it impossible?
This is what I came up with
async function fetchHTMLContent(url) {
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Failed to fetch: ${response.status} ${response.statusText}`);
}
const htmlContent = await response.text();
return htmlContent;
} catch (error) {
console.error('Error:', error);
return 'Error';
}
}
// Example usage:
const url = 'https://example.com'; // Replace with the URL of the webpage you want to fetch
fetchHTMLContent(url)
.then(htmlContent => {
if (htmlContent && htmlContent !== 'Error') {
console.log('HTML content:', htmlContent);
} else {
console.log('Failed to fetch HTML content.');
}
});
Hi @JJJJJJJJJJJ,
Could you please provide further details about your specific use case and the problem you're experiencing with Code by Pabbly?
Use case is having a Code action with aforemention javascript code fetch the HTML source code of a given url.
Problem the action returns a blank output
We attempted to execute this code in an online JS compiler and encountered an error. Please verify whether the code is correct or not.