cherry

package module
v0.0.0-...-125c38c Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 3 Imported by: 0

README

Cherry Web Crawling Framework

Cherry is a web crawling framework written in Go. It features a scrapy-like API. If you need fast and good productivity, you can try cherry.

The key features of Cherry are:
  • Fast
  • Concise
  • Multiple Topic Parallel
  • Multiple Model Binding
  • Multiple Database Binding
  • Auto Data Persistent Storage
  • Support: DB2、MySQL、Oracle

Getting started

Prerequisites

Go Version: >=1.17

Getting Cherry

With Go module support, simply add the following import to your code.

import "github.com/go2rust1/cherry"

Otherwise, run the following command to install the cherry package

go get -u github.com/go2rust1/cherry

Running Cherry

package main

import (
  "github.com/go2rust1/cherry"
)

type Model struct {
	F1 string `db:"F1"`
	F2 string `db:"F2"`
}

func Parser(topic cherry.Topic, response cherry.Response) {
	topic.Send(Model{F1: "", F2: ""})
}

func main() {
	db := cherry.MySQL()
  	db.SetDSN("")
  	db.SetTable("")
  	db.Bind(Model{})
  
	_cherry := cherry.New()

	topic, _ := _cherry.NewTopic("TopicName")
	topic.Request("https://www.baidu.com/", Parser, nil)
	topic.Bind(db)

	_cherry.Start()
}

Learn more examples

Learn and practice more examples, please read the

github.com/go2rust1/cherry/examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB2

func DB2() trait.Database

func MySQL

func MySQL() trait.Database

func New

func New() trait.Cherry

func Oracle

func Oracle() trait.Database

Types

type Response

type Response = trait.Response

type Topic

type Topic = trait.Topic

Jump to

Keyboard shortcuts

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