问题
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.
来源:https://stackoverflow.com/questions/53708299/headless-browser-in-azure-functions-javascript