我正在嘗試在我的 React JS 學(xué)校項目中使用來自https://github.com/BlakeStevenson/populartimes.js的網(wǎng)絡(luò)爬蟲。我不斷收到一條錯誤消息:../node_modules/populartimes.js/node_modules/puppeteer/lib/WebSocketTransport.js Module not found: Can't resolve 'ws' in ...我做了一些研究,我認(rèn)為這是 puppeteer 如何與 React JS 交互的問題。無論如何我可以解決這個問題嗎?這是我正在使用的與刮板相關(guān)的所有代碼:import React, { Component } from 'react';import { Map, GoogleApiWrapper, InfoWindow, Marker } from 'google-maps-react';let temp;const populartimes = require('populartimes.js');populartimes('ChIJKznozuF0hlQRbfbe7fJJ1rM').then(out => {temp=out.now.percent});我已經(jīng)安裝了 websocket 和 puppeteer。
在 React JS 中使用 Puppeteer 進行 Web 抓取
梵蒂岡之花
2022-10-08 17:00:26