Website Content Crawler avatar
Website Content Crawler
Try for free

No credit card required

View all Actors
Website Content Crawler

Website Content Crawler

apify/website-content-crawler
Try for free

No credit card required

Crawl websites and extract text content to feed AI models, LLM applications, vector databases, or RAG pipelines. The Actor supports rich formatting using Markdown, cleans the HTML, downloads files, and integrates well with 🦜🔗LangChain, LlamaIndex, and the wider LLM ecosystem.

BI

hyperlinks in markdown are broken

Closed

biscayneworks opened this issue
5 months ago

when exporting the results of a scrape, the markdown has broken hyperlinks such as:

[

Admin & Relations

](/careers_category/admin-relations)

is it possible to remove the unwanted space after [ and before ] so that the markdown is as expected?

janbuchar avatar

Hello, and thank you for your interest in the Actor!

Website Content Crawler uses the Turndown library to convert from HTML to markdown. I have verified that the library behaves like you describe:

1import TurndownService from 'turndown';
2const str = `<a href="/careers/career-fields/admin-relations" class="promo-box tab-focus" style="background-image: url(&quot;https://content.nationalguard.com/sites/default/files/adminrelations2023.jpg&quot;);"><div class="inner"><h4 class="promo-title">Admin &amp; Relations</h4> <h6>
3         Learn more.
4         <i class="fas fa-chevron-right" aria-hidden="true"></i></h6></div> <div class="overlay"></div></a>`;
5const td = TurndownService({headingStyle: 'atx', codeBlockStyle: 'fenced'});
6td.turndown(str); // returns broken markdown link

I'm afraid that there is nothing we can do on our end. You can open an issue with turndown (https://github.com/mixmark-io/turndown), or you could remove the offending links completely with the removeElementsCssSelector option. Or you could ignore the markdown produced by Website Content Crawler and perform the conversion using a different tool after you download the dataset (using the HTML as input - you need to enable that with the "Save HTML" option).

Hope that helps!

Developer
Maintained by Apify
Actor metrics
  • 2.8k monthly users
  • 318 stars
  • 100.0% runs succeeded
  • 4 days response time
  • Created in Mar 2023
  • Modified 1 day ago