wancak

package module
v0.0.0-...-f35ce41 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2015 License: GPL-2.0 Imports: 6 Imported by: 0

README

UnOfficial 1Cak API

api doc

Kabar gembira buat kita semua, kini 1Cak ada API nya :D

Fitur

Dapetin postingan per-section

http://api-1cak.herokuapp.com/{section}/{page id}
Parameter
Parameter Deskripsi
section required Ada 4 section, lol (Hot), trend (Trending), recent (Vote), legendary (Legend)
page id optional Untuk melihat post selanjutnya
Contoh request

GET http://api-1cak.herokuapp.com/lol

Response

{  
    "page":{  
        "next":"1424046302"
    },
    "posts":[  
        {  
            "id":"1009826",
            "title":"Bangga Punya Walikota Seperti Ini",
            "url":"http://1cak.com/1009826",
            "img":"http://cdn16.1cak.com/posts/ddf26c6597454290c6ef7ef0f9597fc0_t.jpg",
            "votes":"268",
            "nsfw":false
        },
        {  
            "id":"1009821",
            "title":"Ini Judul",
            "url":"http://1cak.com/1009821",
            "img":"http://cdn1.1cak.tv/posts/21aaaff60ff76b067c415d642aafb9a5_t.jpg",
            "votes":"341",
            "nsfw":false
        },
        {  
            "id":"1009813",
            "title":"Wild Life!",
            "url":"http://1cak.com/1009813",
            "img":"http://cdn1.1cak.tv/posts/635fe894b99517a35dd61447a0a6d1dd_t.jpg",
            "votes":"356",
            "nsfw":false
        }
    ]
}

Single Post

http://api-1cak.herokuapp.com/post/{id}
Parameter
Parameter Deskripsi
id required id post, numerik
Contoh request

GET http://api-1cak.herokuapp.com/post/1009826

Response

{  
    "id":"1009826",
    "title":"Bangga Punya Walikota Seperti Ini",
    "url":"http://1cak.com/1009826",
    "img":"http://cdn16.1cak.com/posts/ddf26c6597454290c6ef7ef0f9597fc0_t.jpg",
    "votes":"300",
    "nsfw":false
}

Random Post (Shuffle)

http://api-1cak.herokuapp.com/random

Search Post

http://api-1cak.herokuapp.com/search?q={keyword}&pageid={id}

Param:

  • keyword (required)
  • pageid (optional)

contoh

GET http://api-1cak.herokuapp.com/search?q=jomblo ngenes&pageid=123123123

Documentation

Index

Constants

View Source
const (
	Url1cak string = "http://1cak.com"
)

Variables

View Source
var (
	NotFoundErr       error = errors.New("Post not found")
	InvalidSectionErr error = errors.New("Invalid section")
)

Functions

This section is empty.

Types

type Post

type Post struct {
	Id    string `json:"id"`
	Title string `json:"title"`
	Url   string `json:"url"`
	Img   string `json:"img"`
	Votes string `json:"votes"`
	NSFW  bool   `json:"nsfw"`
}

func GetPostId

func GetPostId(id string) (*Post, error)

Mengambil postingan berdasarkan id post, jika id kosong, ambil postingan acak

type Posts

type Posts struct {
	Page struct {
		// adalah post id, digunakan untuk mengambil postingan selanjutnya
		Next string `json:"next"`
	} `json:"page"`
	Posts []Post `json:"posts"`
}

func GetSectionPosts

func GetSectionPosts(section string, pageId ...string) (*Posts, error)

Ambil postingan per section (3 postingan)

List section: lol : Hot trend : Trending recent : Vote legendary : Legend

parameter page id opsional, digunakan untuk mengambil postingan selanjutnya

func Search(q string, pageId ...string) (*Posts, error)

Mencari postingan berdasarkan keyword tertentu parameter page id opsional, digunakan untuk mengambil postingan selanjutnya

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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