Skip to content

Commit

Permalink
fix auto update browser and install
Browse files Browse the repository at this point in the history
  • Loading branch information
iuu6 committed Aug 6, 2024
1 parent 5c229bd commit e40e7b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion functions/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func HandleViewCommand(inlineQuery *tgbotapi.InlineQuery, bot *tgbotapi.BotAPI)
}

if pageData.Title == "" || pageData.Node == "" {
// 返回不支持此链接的消息
results := []interface{}{
tgbotapi.NewInlineQueryResultArticleHTML(
inlineQuery.ID,
Expand Down Expand Up @@ -99,6 +98,11 @@ func HandleViewCommand(inlineQuery *tgbotapi.InlineQuery, bot *tgbotapi.BotAPI)
}

func fetchPageData(targetURL string) (PageData, error) {
// 自动安装浏览器依赖
if err := playwright.Install(); err != nil {
return PageData{}, fmt.Errorf("could not install browsers: %w", err)
}

pw, err := playwright.Run()
if err != nil {
return PageData{}, fmt.Errorf("could not start playwright: %w", err)
Expand Down

0 comments on commit e40e7b7

Please sign in to comment.