搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.8

chaleno

一個用於透過較少程式碼行輕鬆快速從網站擷取資料的套件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
362
喜歡數
140
Pub 分數
140

安裝套件

flutter pub add chaleno

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Chaleno 是一個 Flutter/Dart 套件,旨在透過讓開發者以最少的程式碼從網站提取資料來簡化網路爬蟲。它簡化了在 Android、iOS、Web、macOS、Windows 和 Linux 等多個平台取得和解析 HTML 內容的流程。此套件注重效率,減少通常用於 HTTP 請求和 DOM 操作所需的重複程式碼,非常適合快速資料收集任務。Chaleno 可無縫整合至 Flutter 專案中,並利用 Dart 的非同步功能實現快速且可靠的爬取作業。

適用情境

  • 從電子商務網站提取產品詳細資訊
  • 抓取新聞文章或部落格貼文
  • 收集公共數據以進行分析
  • 從公共網頁自動收集數據

主要特色

  • 網頁抓取的最小程式碼
  • 跨平台支援
  • 內建的 HTML 解析
  • 非同步請求處理
  • 輕便且快速
  • 與 Flutter 的輕鬆整合

適合對象

  • 開發資料聚合工具的開發者
  • 需要頻繁進行網路數據提取的項目
  • 快速原型化爬蟲
  • 需要即時公開資料的應用

使用建議

  • 確保符合網站的服務條款
  • 限速可能是為了避免被阻擋而必要的
  • 不適用於需要複雜JavaScript渲染的網站
  • 可能需要額外的解析邏輯來處理動態內容

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Chaleno

A flutter package for webscraping data from websites.

This package contains a set of high-level functions that make it easy to webscrap websites. It's multi-platform, supports mobile, desktop, and the web.

Usage

Scraping data from websites, this package gives you the power to scrape the web in an easy way.

Instance Chaleno class
var parser = await Chaleno().load('https://example.com');

It returns a Parser which we can use to start webscraping.

You can load HTML file from localhost.

var parser = await Chaleno().load('https://localhost/index');

var parser = await Chaleno().load('https://192.168.1.122/index');
Very simple to use

After instantiating Chaleno class, you can easily retrieve any data using few code lines

Result result = parser.getElementById('id');
print(result.text);

List<Result> results = parser.getElementsByClassName('className');
results.map((item) => print(item.text))

You can return a single result or a list of results and map them. You can find most popular methods and attributes in table below.

Example
final parser = await Chaleno().load('https://example.com');

final title = parser?.getElementById('title').text;
final contents = parser.querySelector('.content-card').text;
final image = parser.getElementsByTagName('img').src;

Importants Methods and propriets

Methods Mean
title Return the page title
getElementById Return a single element searching for ID on the page
getElementsByClassName Return a list of elements according class passed as parameter
getElementsByTagName Return a list of elements according tag passed as parameter
querySelector Return single element passing a list of selector
querySelectorAll Return a list of elements passing a list of selector
text Return text atribute from a tag returned
src Return src atribute from a tag returned
href Return href atribute from a tag returned

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。