GithubHelp home page GithubHelp logo

Comments (11)

coder-hxl avatar coder-hxl commented on May 11, 2024 1
import xCrawl from 'x-crawl'

const myXCrawl = xCrawl({ crawlPage: { puppeteerLaunch: { args: ['--no-sandbox'] } })

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024 1

@allmors 这是个小示例,让 AI 帮你快速提取一些想要的内容

image
image

传给 AI 的 HTML :
image

结果:

{
  elements: [
    {
      src: 'https://z1.muscache.cn/im/pictures/miso/Hosting-45937791/original/c67d32ed-21eb-4066-8cef-650dcd45bada.jpeg?aki_policy=large'    },
    {
      src: 'https://z1.muscache.cn/im/pictures/df3493cf-39b2-46cc-9e85-7ef186980f25.jpg?aki_policy=large'
    },
    {
      src: 'https://z1.muscache.cn/im/pictures/52d375d3-5e54-444b-8186-15e61a592d9a.jpg?aki_policy=large'
    }
  ],
  type: 'multiple'
}

也可以将整个 HTML 传给 AI 帮我们操作,但是会消耗更多 Tokens

from x-crawl.

github-actions avatar github-actions commented on May 11, 2024

Welcome to submit an issue for x-crawl for the first time

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024

这里 const { browser, page } = res.data 获取得到 data 吗

from x-crawl.

allmors avatar allmors commented on May 11, 2024

这里 const { browser, page } = res.data 获取得到 data 吗

linux获取不到的,我抛异常了,大致知道问题出在哪,x-crawl依赖puppeteer,安装的时候不安装chrome,但是我看puppeteer这里说的是会自动安装,我也尝试曲线救国安装了pnpm i puppeteer让它自动安装chrome,但是还是无法正常使用x-crawl

现在我打算手动安装chrome-linux64试试

14:29-补充说明:
(已经是root权限)手动安装了一些列依赖,现在报一个错误 Running as root without --no-sandbox is not supported.,问题源:https://crbug.com/638180,按照pptr的用法,const browser = await puppeteer.launch({ args: ['--no-sandbox'] });,x-crawl支持设置这个吗,我看api文档没提到

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024

https://github.com/coder-hxl/x-crawl/blob/main/docs/cn.md#xcrawlconfig 看这里 puppeteerLaunch 选项

from x-crawl.

allmors avatar allmors commented on May 11, 2024
import xCrawl from 'x-crawl'

const myXCrawl = xCrawl({ crawlPage: { puppeteerLaunch: { args: ['--no-sandbox'] } })

是的,我就是这样的,感谢解答,可以使用了
image

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024

@allmors ok,可以用了那我就关闭这个 Issues 了

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024

下一个版本这个 puppeteerLaunch 会变成 puppeteerLaunchOptions 得注意一下,加入了 AI 后会有很多东西发生改变。

from x-crawl.

allmors avatar allmors commented on May 11, 2024

下一个版本这个 puppeteerLaunch 会变成 puppeteerLaunchOptions 得注意一下,加入了 AI 后会有很多东西发生改变。

加入的AI是收费模式还是说开放的,我们自己根据ai平台调api?

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024

要用到 openai 的 APIKey ,底层是对 openai 进行了封装。openai 的 APIKey 也有免费的渠道,到时候我也会在文档那发出来。

image

目前这几个方法已经实现了,后续可能加入更多。

想详细了解可以看看这里 https://github.com/coder-hxl/x-crawl/tree/embracingAI/packages/ai

from x-crawl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.