erod

package module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

README

Go Reference Discord

介绍

ERod 是基于 energyrod 封装的 DevTools 协议。 它专为 Web 自动化和抓取而设计,适用于高级和低级使用, 高级开发人员可以轻松使用低级包和功能 自定义或构建自己的 Rod 版本,高级函数只是构建默认版本 Rod 的示例。

ERod 底层直接使用 CEF API 操作 DevTools 协议方法, 而不是使用浏览器DevTools协议

  • energy: 基于 LCL 和 CEF 的跨平台GUI框架
  • rod: 基于 DevTools 协议的高级驱动程序,在ERod中移除了浏览器DevTools协议消息,底层消息处理直接使用 CEF API 回调消息函数

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError

func CheckError(err error)

func JSONParse

func JSONParse(jsonByte []byte) (result *cef.ICefDictionaryValue)

func ReadData

func ReadData(data uintptr, count uint32) []byte

ReadData Read pointer data to [] byte

Types

type Energy

type Energy struct {
	// contains filtered or unexported fields
}

Energy Devtools message processing structure for rod extension encapsulation

func NewEnergyChromium

func NewEnergyChromium(owner lcl.IWinControl, config *cef.TCefChromiumConfig) *Energy

NewEnergyChromium Create a chrome and layout it in the current main window

func NewEnergyWindow

func NewEnergyWindow(config *cef.TCefChromiumConfig, windowProperty cef.WindowProperty, owner lcl.IComponent) *Energy

NewEnergyWindow creates a window

func (*Energy) BrowserWindow

func (m *Energy) BrowserWindow() cef.IBrowserWindow

BrowserWindow return Window

func (*Energy) Call

func (m *Energy) Call(ctx context.Context, sessionID, method string, params interface{}) ([]byte, error)

Call a method and wait for its response.

func (*Energy) ChromiumBrowser

func (m *Energy) ChromiumBrowser() cef.ICEFChromiumBrowser

ChromiumBrowser Return Creating objects for packaged Chromium

func (*Energy) CreateBrowser

func (m *Energy) CreateBrowser()

CreateBrowser Call this function to create a browser after creating chrome or window

func (*Energy) EachEvent

func (m *Energy) EachEvent(callbacks ...interface{}) (wait func())

EachEvent is similar to [Page.EachEvent], but catches events of the entire browser.

func (*Energy) Event

func (m *Energy) Event() <-chan *cdp.Event

Event returns a channel that will emit browser devtools protocol events. Must be consumed or will block producer.

func (*Energy) LoadSuccess

func (m *Energy) LoadSuccess() bool

LoadSuccess Return whether the current page was successfully loaded

func (*Energy) Page

func (m *Energy) Page() *rod.Page

Page Return the current Chromium Page

func (*Energy) PageLoadProcess

func (m *Energy) PageLoadProcess() float64

PageLoadProcess Return to page loading progress

func (*Energy) Pending

func (m *Energy) Pending() *sync.Map

Pending Each message event result map

func (*Energy) RodBrowser

func (m *Energy) RodBrowser() *rod.Browser

RodBrowser return RodBrowser

Note that the devtools and rod for operating CEF in energy are different, and some functions cannot be directly used through rod For example, window state management or chrome closure requires obtaining window objects and chrome objects directly for use

func (*Energy) SetOnBeforePopup

func (m *Energy) SetOnBeforePopup(fn OnBeforePopup)

SetOnBeforePopup energy rod popup callback

func (*Energy) SetOnClose

func (m *Energy) SetOnClose(fn OnClose)

SetOnClose window close callback

func (*Energy) SetOnDevToolsRawMessage

func (m *Energy) SetOnDevToolsRawMessage(fn OnDevToolsRawMessage)

SetOnDevToolsRawMessage Call SendDevToolsMessage or ExecuteDevToolsMethod. If successfully validated, the callback function will be executed and it will return the execution result

func (*Energy) SetOnLoadingProgressChange

func (m *Energy) SetOnLoadingProgressChange(fn OnLoadingProgressChange)

SetOnLoadingProgressChange page load process

func (*Energy) TargetInfo

func (m *Energy) TargetInfo() *proto.TargetTargetInfo

TargetInfo Return current target info

func (*Energy) Targets

func (m *Energy) Targets() []*proto.TargetTargetInfo

Targets Return All Targets Info

func (*Energy) WaitDownload

func (m *Energy) WaitDownload(downloadPath string) func() (info *proto.PageDownloadWillBegin)

type OnBeforeDownload

type OnBeforeDownload func(suggestedName string) (downloadPath string, showDialog bool)

type OnBeforePopup

type OnBeforePopup func(energy *Energy)

type OnClose

type OnClose func(energy *Energy)

type OnDevToolsRawMessage

type OnDevToolsRawMessage func(data []byte)

type OnLoadingProgressChange

type OnLoadingProgressChange func(energy *Energy, progress float64)

type Result

type Result struct {
	Msg json.RawMessage
	Err error
}

Directories

Path Synopsis
examples
devtools command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL