The command is as follows
Start cmd window to execute instructions
The wait is over
Create js file
Write the following code
const jsdom=require("jsdom")const {JSDOM}=jsdomconst resourceLoader=new jsdom.ResourceLoader({ userAgent: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Core/1.94.196.400 QQBrowser/11.7.5286.400"});const html="<!DOCTYPE html><p>Hello world</p>";const dom=new JSDOM(html,{ url:"https://www.endata.com.cn/BoxOffice/BO/Year/index.html", referrer:"https://www.endata.com.cn/BoxOffice/BO/Year/index.html", contentType:"text/html", resource:resourceLoader,});window=global;const params={ location:{ hash: "", host: "www.endata.com.cn/", hostname: "www.endata.com.cn/", href: "https://www.endata.com.cn/BoxOffice/BO/Year/index.html", origin: "https://www.endata.com.cn/BoxOffice/BO/Year/index.html", pathname: "/", port: "", protocol: "http:", search: "" }, navigator:{ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.67", }}//拼接对象Object.assign(global,params)document=dom.window.documentwindow=dom.window
You can write js function below
Use python to call js as follows
Import module execjs
If not, you can install it with pip
Configure the package path of the module
The picture has been blocked because it contains sensitive information.
Take a look at the code and copy it to run the js code