Code Monkey home page Code Monkey logo

tbspider's Introduction

tbspider

A simple spider for taobao products, write with golang.

Usage

  1. Use go get github.com/songjiayang/tbspider/spider
package main

import (
	"fmt"

	"github.com/songjiayang/tbspider/spider"
)

func main() {
	q := &spider.Query{
		Kw: "袜子",
	}
	
	worker := spider.NewSpider(q, "./cookie")

	err := worker.Run()
	if err != nil {
		panic(err)
	}

	fmt.Println(worker.Result())
}
  1. Or use cli command tool
$ tbspider -h

Usage of tbspider:
  -cookie string
    	淘宝登录cookie (default "./cookie")
  -l int
    	最多获取商品数量 (default 200)
  -loc string
    	发货地
  -mall
    	是否只抓取天猫数据,默认抓取淘宝数据
  -max float
    	最高价格
  -min float
    	最低价格
  -q string
    	查询关键词
  -sort int
    	商品排序,可选参数: 0 人气, 1 销量,2 信用,3 价格由低到高,4 价格由高到低
    	

when you run tbspider -q 袜子, you will get data in filename 袜子-2017xxxx.json.

Data struct

type Item struct {
	Title        string `json:"raw_title"`
	Link         string `json:"detail_url"`
	Price        string `json:"view_price"`
	Free         string `json:"view_fee"`
	Loction      string `json:"item_loc"`
	CommentCount string `json:"comment_count"`

	ShopName string `json:"nick"`
	ShopLink string `json:"shopLink"`
}

tbspider's People

Contributors

songjiayang avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tbspider's Issues

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.