Node.js nodej正在编写一个可以读取JS保护的网站的scraper

Node.js nodej正在编写一个可以读取JS保护的网站的scraper,node.js,npm,web-scraping,scraper,Node.js,Npm,Web Scraping,Scraper,nodejs对我来说是新事物,我刚刚开始学习web scraper。问题是我需要废弃一个受JS保护的网站。所以我需要从网站上获取电话,但只有在用户点击“显示号码”按钮后,才会显示带有电话号码的div。有什么方法或npm可以得到这些数字吗?这是网站,但它是俄语的。因此,按钮为“Пзззззззззззззз107。提前谢谢你 转到带有电话号码的页面,打开控制台,查看您的网络工具。当你点击一个电话号码时,它会发出一个ajax请求,并给你一个很好的格式化响应 {"status":"ok","phone

nodejs对我来说是新事物,我刚刚开始学习web scraper。问题是我需要废弃一个受JS保护的网站。所以我需要从网站上获取电话,但只有在用户点击“显示号码”按钮后,才会显示带有电话号码的div。有什么方法或npm可以得到这些数字吗?这是网站,但它是俄语的。因此,按钮为“Пзззззззззззззз107。提前谢谢你

转到带有电话号码的页面,打开控制台,查看您的网络工具。当你点击一个电话号码时,它会发出一个ajax请求,并给你一个很好的格式化响应

{"status":"ok","phone":"+7 (727) 317-20-86","html_tooltip":"<section class=\"company-phones-tooltip\">\r\n    <div class=\"company-phones-tooltip__wrap\">\r\n        <header class=\"company-phones-tooltip__header\">\r\n            Inform the manager that you learned the information on Allbiz.\r\n        <\/header>\r\n        <ul class=\"company-phones-tooltip-list\">\r\n                            <li class=\"company-phones-tooltip-list__item\">\r\n                    <div class=\"company-phones-tooltip-list__name\">\r\n                        management\r\n                    <\/div>\r\n                    <div class=\"company-phones-tooltip-list__number\">\r\n                        +7 (727) 317-20-86\r\n                    <\/div>\r\n                <\/li>\r\n                    <\/ul>\r\n        <footer class=\"company-phones-tooltip__footer\">\r\n            <a class=\"company-phones-tooltip__link\" href=\"https:\/\/12246-kz.all.biz\/contacts\" target=\"_blank\">\r\n                Show all contacts\r\n            <\/a>\r\n        <\/footer>\r\n    <\/div>\r\n<\/section>"}
{“status”:“ok”,“phone”:“+7(727)317-20-86”,“html\u工具提示”:”\r\n\r\n通知经理您了解了有关Allbiz的信息。\r\n\r\n
    \r\n
  • \r\n\r\n管理\r\n\r\n\r\n+7(727)317-20-86\r\n\r\n\r\n\r\n在抓取页面后使用正确参数的端点。并且此端点所需的所有查询参数都在html元素中

    <div class="company-phones__wrap" data-click="company-phones" data-entid="58474" data-verify="bYjmFpAfm5QWOgIjx8cyNOARdSG3FIoPo6he2dYGLIc=" data-phone="Zk6xDyCXPMqWMXgTaCI51A24FHIsDwuy8IaF993LsHI=" data-country="kz" data-placement="company-phones-tooltip___3" data-tooltip-direction="left" data-source="list">
            <div class="company-phones__code">+7(7&nbsp;</div>
            <div class="company-phones__main" data-ga="show-phones-list" data-ga-id="">
                <div class="company-phones__btn">Показать телефоны</div>
            </div>
        </div>
    
    
    +7(7 
    Показать телефоны
    
    您将需要使用selenium之类的工具来进行抓取。它可以在具有动态生成数据的站点上工作,也可以使用数据输入和虚拟鼠标交互与站点进行交互。感谢您的回答,我尝试过这样做,但它只输出“错误请求”你试过这个方法吗?对你有用吗?也许我做错了什么