I tried using phantomjs but apparently it's unsupported, is there any way to scrape websites using azure functions in javascript?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There are many restrictions on Azure App Service (includes WebApps, Function Apps), such as Win32k.sys (User32/GDI32) Restrictions. So some packages are not supported on Azure App Service, which like PhantomJS/puppteer be required to start a headless browser which needs GDI support to communicate with javascript/nodejs to get DOM node.
You can scrape a static web page or only HTML via Node http.ClientRequest
or Request package in Function App. If to scrape a DOM node of a web page dynamically, the only way is using PhantomJS/puppteer on Azure VM, not Function Apps.