Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Apify.utils.social - added support for 'callto:' link

Jan Curn5af64c455e1f
diff --git a/src/utils_social.js b/src/utils_social.js
index 7baa79ede..91eb5613b 100644
--- a/src/utils_social.js
+++ b/src/utils_social.js
@@ -67,8 +67,8 @@ const emailsFromUrls = (urls) => {
};
-// Supports URLs starting with `tel://`, `tel:/` and `tel:`, and similarly `phone` and `telephone`
-const PHONE_URL_PREFIX_REGEX = /^(tel|phone|telephone):(\/)?(\/)?/i;
+// Supports URLs starting with `tel://`, `tel:/` and `tel:`, and similarly `phone`, `telephone` and `callto`
+const PHONE_URL_PREFIX_REGEX = /^(tel|phone|telephone|callto):(\/)?(\/)?/i;
// It's pretty much impossible (and unmaintainable) to have just one large regular expression for all possible phone numbers.
// So here we define various regular expression for typical phone number patterns, which are then used to compile
diff --git a/test/utils_social.js b/test/utils_social.js
index fedda5bcd..5e7710675 100644
--- a/test/utils_social.js
+++ b/test/utils_social.js
@@ -272,12 +272,15 @@ describe('utils.social', () => {
'tel:12345678',
'tel:/22345678', //
'tel://32345678',
- 'phone:42345678', //
+ 'PHONE:42345678', //
'phone:/52345678',
'phone://62345678',
'telephone:72345678',
'telephone:/82345678',
'telephone://92345678',
+ 'callto:97345678',
+ 'CALLTO:/+98345678',
+ 'callto://9992345678',
])).to.eql([
'12345678',
'22345678',
@@ -288,6 +291,9 @@ describe('utils.social', () => {
'72345678',
'82345678',
'92345678',
+ '97345678',
+ '+98345678',
+ '9992345678',
]);
expect(social.phonesFromUrls([