Why when I tried to scrape a page with pre tag / code block it's always empty in the markdown?
I want to get code block of the documentation site, but always get empty
in the results

6 Replies
@orykevin can you share the url you're testing?
I tested this url : https://ai-sdk.dev/docs/reference/ai-sdk-core/agent
Agent
API Reference for the Agent class.
it's empty code block if the code is long, but it captures one line code


okay, I see the issue here, when I test with other websites to get the code block such as firecrawl it works flawlessly because it's well structured with html tags.

@orykevin To make it work with the https://ai-sdk.dev/docs/reference/ai-sdk-core/agent as this site uses unstructured html tags you'll have to use the format option to extract the code example using prompt, refer to this curl request:
this will scrape the code block.

Awesome ! Thanks for the solution, I will try it now