简体   繁体   English

如何在PyV8中加载nodejs模块?

[英]How to load a nodejs module in PyV8?

How can I load a nodejs module in PyV8? 如何在PyV8中加载nodejs模块?

I've read all about how great jsdom is when run with nodejs. 我已经阅读了有关使用nodejs运行时jsdom有多棒的所有信息。 Will I get the same dom-traversing benefits if I run v8 inside a Python app, with python "getting" the web resources, then giving the resulting html strings to the v8 instance, which has loaded jsdom internally 如果我在Python应用程序中运行v8,使用python“获取”Web资源,然后将生成的html字符串提供给v8实例,并在内部加载了jsdom,我是否会获得相同的dom-traversing优势?

(or is this a nonsensical configuration for some reason I haven't thought of yet?) (或者这是一个荒谬的配置,出于某些原因我还没有想过呢?)

I'm afraid this isn't possible as jsdom requires some node constructs which are not available under vanilla v8. 我担心这是不可能的,因为jsdom需要一些在vanilla v8下不可用的节点构造。 Things like require, core libraries, and the method of sandboxing a window would take a bit of work to pull out of jsdom. 像需求,核心库和沙盒窗口的方法之类的东西需要花费一些工作来拉出jsdom。

You may want to take a peek at https://github.com/andreasgal/dom.js/ 你可能想看看https://github.com/andreasgal/dom.js/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM