merscraper

package module
v0.0.0-...-560622f Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: MIT Imports: 10 Imported by: 0

README

go-mercari-scraper

Description

go-mercari-scraper is scrape MERCARI.

save JSON

Installation

$ go get -u github.com/go-numb/go-mercari-scraper

websocket/realtime


package main

import (
    "github.com/go-numb/go-mercari-scraper"
)

func main() {
    // 検索ワードのインプットを要求
    // キーワード取得後、MERCARIで検索後整形、JSONに保存

    // 検索商品が尽きるまでQuery?page=n アクセスをsleep(1sec)で行います
    merscraper.input()
}

設定等々調整してください

const (
	DIR        = "./nosql/"
	MERCARIURL = "https://www.mercari.com/jp/search/?keyword="

	// url query page=n の設定
	// 1ページで120productsほど
	MAXPAGE = 100
)

Author

@_numbP

License

MIT

Documentation

Index

Constants

View Source
const (
	DIR        = "./nosql/"
	MERCARIURL = "https://www.mercari.com/jp/search/?keyword="

	// url query page=n の設定
	// 1ページで120productsほど
	MAXPAGE = 100
)

Variables

This section is empty.

Functions

func GetItemData

func GetItemData(keyword string)

Types

type Output

type Output struct {
	Item struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
		URL         string `json:"url"`
		IsSold      bool   `json:"isSold"`
		Price       string `json:"price"`
		Tax         string `json:"tax"`
		ShippingFee string `json:"shippingFee"`
		Size        string `json:"size"`
		Brand       struct {
			ID   string `json:"id"`
			Name string `json:"name"`
			URL  string `json:"url"`
		} `json:"brand"`
		Category struct {
			Large  string `json:"large"`
			Medium string `json:"medium"`
			Small  string `json:"small"`
		} `json:"category"`
		Condition string `json:"condition"`
	} `json:"item"`
	Seller struct {
		URL       string `json:"url"`
		ID        string `json:"id"`
		Name      string `json:"name"`
		ImageURL  string ``
		Evaluates struct {
			Good   string `json:"good"`
			Normal string `json:"normal"`
			Bad    string `json:"bad"`
		} `json:"evaluates"`
		Description string `json:"description"`
		Items       struct {
			Selling int `json:"selling"`
			Sold    int `json:"sold"`
		} `json:"items"`
	} `json:"seller"`
	Shipping struct {
		Payer          string `json:"payer"`
		OriginLocation string `json:"originLocation"`
		Type           string `json:"type"`
		LeadTime       string `json:"leadTime"`
	} `json:"shipping"`
}

func GetItemDetail

func GetItemDetail(url string) Output

Jump to

Keyboard shortcuts

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