godc

package module
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

README

godc

Go Report Card GoDoc

디시인사이드 비공식 API

게시글 목록,게시글 내용, 갤러리 목록 읽기 기능만 지원하고 있습니다. 나머지 기능은 추가 예정

Install

go get github.com/dfkdream/godc/v2

Document

Writer
필드 이름 자료형 설명
Name string 작성자 이름
Identity string 작성자 ID/IP
IsSignedIn bool 로그인 여부
ArticleData
필드 이름 자료형 설명
URL string 게시글 URL
Title string 게시글 제목
Type string 게시글 타입
Tag string 게시글 말머리
ReplyCount string 댓글 수
Timestamp string 작성 시간
ViewCounter string 조회수
UpVote string 추천 수
Writer Writer 작성자
ArticleData.Type
string 설명
ico_pic ico_t 텍스트만
ico_pic ico_p_y 이미지 포함
ico_pic ico_mv 동영상 포함
ico_pic ico_t_c 텍스트만, 개념글
ico_pic ico_p_c 이미지 포함, 개념글
ArticleBody
필드 이름 자료형 설명
Title string 게시글 제목
Timestamp string 작성 시간
ViewCounter string 조회수
ReplyCount string 댓글 수
Body string(HTML) 게시글 내용
UpVote string 추천 수
DownVote string 비추천 수
Replies []Reply 댓글
Writer Writer 작성자
Reply
필드 이름 자료형 설명
Type string 댓글(reply)/대댓글(re-reply) 구분
Body string(HTML) 댓글 내용
Timestamp string 작성 시간
Writer Writer 작성자
GallInfo
필드 이름 자료형 설명
Category string 갤러리 카테고리
Name string 갤러리 코드
KoName string 갤러리 이름
Manager string 매니저 ID
SubManager string( , 로 구분) 부매니저 ID
No string 겔러리 번호

Example Code

GalleryID 갤러리의 게시글 목록 1페이지를 읽어옵니다.

package main

import (
	"fmt"
	"log"

	"github.com/dfkdream/godc/v2"
)

func main() {
	dat, err := godc.FetchArticleList("<GalleryID>", 1, false)

	if err != nil {
		log.Fatal(err)
	}

	for index, data := range dat {
		fmt.Printf("=============article%d==============\n", index)
		fmt.Printf("URL: %s\nTitle: %s\nType: %s\nReplyCount: %s\nTimestamp : %s\nViewCount : %s\nUpVote : %s\nWriter : %+v",
			data.URL,
			data.Title,
			data.Type,
			data.ReplyCount,
			data.Timestamp,
			data.ViewCount,
			data.UpVote,
			data.Writer)
	}
}

Documentation

Overview

Package godc reads list of posts from the DCInside Gallery.

디시인사이드 갤러리 게시글 목록을 읽어오는 패키지

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArticleBody

type ArticleBody struct {
	Title       string  `json:"title"`
	Writer      Writer  `json:"writer"`
	Timestamp   string  `json:"timestamp"`
	ViewCounter string  `json:"viewCount"`
	ReplyCount  string  `json:"replyCount"`
	Body        string  `json:"body"`
	UpVote      string  `json:"upVote"`
	DownVote    string  `json:"downVote"`
	Replies     []Reply `json:"replies"`
}

ArticleBody contains article information.

func FetchArticleData

func FetchArticleData(URL string) (*ArticleBody, error)

FetchArticleData reads article data of specific URL

지정한 URL의 게시물을 읽어옵니다.

type ArticleData

type ArticleData struct {
	URL        string `json:"url"`
	Title      string `json:"title"`
	Writer     Writer `json:"writer"`
	Type       string `json:"type"`
	Tag        string `json:"tag"`
	ReplyCount string `json:"replyCount"`
	Timestamp  string `json:"timestamp"`
	ViewCount  string `json:"viewCount"`
	UpVote     string `json:"upVote"`
}

ArticleData contains post(list) information.

func FetchArticleList

func FetchArticleList(gallID string, page int, recommend bool) ([]ArticleData, error)

FetchArticleList reads specific page of post list.

게시글 목록의 지정된 페이지를 읽어옵니다

type ArticleSearchData

type ArticleSearchData struct {
	Articles []ArticleData `json:"articles"`
	NextPos  string        `json:"nextPos"`
}

ArticleSearchData contains post info including ser_pos URL

func FetchArticleSearch

func FetchArticleSearch(gallID string, page string, query string, searchType string, next string) (*ArticleSearchData, error)

FetchArticleSearch reads specific page of post search result.

페이지 검색의 지정한 페이지를 읽어옵니다.

type GallInfo

type GallInfo struct {
	Category   string `json:"category"`
	Name       string `json:"name"`
	KoName     string `json:"ko_name"`
	Manager    string `json:"manager"`
	SubManager string `json:"submanager"`
	No         string `json:"no"`
}

GallInfo contains gallery info used by FetchMajor/MinorGallList.

func FetchMajorGallList

func FetchMajorGallList() ([]GallInfo, error)

FetchMajorGallList download and parse every major gallery list.

모든 메이저 갤러리 목록을 읽어옵니다.

func FetchMinorGallList

func FetchMinorGallList() ([]GallInfo, error)

FetchMinorGallList download and parse every major gallery list.

모든 마이너 갤러리 목록을 읽어옵니다.

type Reply

type Reply struct {
	Writer    Writer `json:"writer"`
	Type      string `json:"type"`
	Body      string `json:"body"`
	Timestamp string `json:"timestamp"`
}

Reply contains reply data of articleBody.

type Writer

type Writer struct {
	Name       string `json:"name"`
	IsSignedIn bool   `json:"isSignedIn"`
	Identity   string `json:"identity"`
}

Writer contains writer information.

Jump to

Keyboard shortcuts

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