tiktok_api

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: MIT Imports: 5 Imported by: 0

README

tiktok-api

TikTok api sdk for simple video embedding

Go Report Card GoDoc codecov

Installation
go get -u github.com/arthurkushman/tiktok-api 
Usage

To get an embedded content of any video:

tts := NewTikTokService()
resp, err := tts.Embed(map[string]string{
    "url": "https://www.tiktok.com/@scout2015/video/6718335390845095173",
})

resp.Title // "Scramble up ur name & I’ll try to guess it😍❤️ #foryoupage #petsoftiktok #aesthetic"
resp.AuthorName // "Scout & Suki"
// and more props - see Response structure bellow

resp is a Response struct with all the fields filled-up e.g.:

type Response struct {
  Version: "1.0",
  Type: "video",
  Title: "Scramble up ur name & I’ll try to guess it😍❤️ #foryoupage #petsoftiktok #aesthetic",
  AuthorUrl: "https://www.tiktok.com/@scout2015",
  AuthorName: "Scout & Suki",
  Width: "100%",
  Height: "100%",
  Html: "<blockquote class=\"tiktok-embed\" cite=\"https://www.tiktok.com/@scout2015/video/6718335390845095173\" data-video-id=\"6718335390845095173\" style=\"max-width: 605px;min-width: 325px;\" > <section> <a target=\"_blank\" title=\"@scout2015\" href=\"https://www.tiktok.com/@scout2015\">@scout2015</a> <p>Scramble up ur name & I’ll try to guess it😍❤️ <a title=\"foryoupage\" target=\"_blank\" href=\"https://www.tiktok.com/tag/foryoupage\">#foryoupage</a> <a title=\"petsoftiktok\" target=\"_blank\" href=\"https://www.tiktok.com/tag/petsoftiktok\">#petsoftiktok</a> <a title=\"aesthetic\" target=\"_blank\" href=\"https://www.tiktok.com/tag/aesthetic\">#aesthetic</a></p> <a target=\"_blank\" title=\"♬ original sound - 𝐇𝐚𝐰𝐚𝐢𝐢𓆉\" href=\"https://www.tiktok.com/music/original-sound-6689804660171082501\">♬ original sound - 𝐇𝐚𝐰𝐚𝐢𝐢𓆉</a> </section> </blockquote> <script async src=\"https://www.tiktok.com/embed.js\"></script>",
  ThumbnailWidth: 720,
  ThumbnailHeight: 1280,
  ThumbnailUrl: "https://p16.muscdn.com/obj/tos-maliva-p-0068/06kv6rfcesljdjr45ukb0000d844090v0200010605",
  ProviderUrl: "https://www.tiktok.com",
  ProviderName: "TikTok"
}

It allows you to get the embed code and additional information about the video associated with the webpage link provided.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	Version         string `json:"version"`
	Type            string `json:"type"`
	Title           string `json:"title"`
	AuthorUrl       string `json:"author_url"`
	AuthorName      string `json:"author_name"`
	Width           string `json:"width"`
	Height          string `json:"height"`
	Html            string `json:"html"`
	ThumbnailWidth  uint64 `json:"thumbnail_width"`
	ThumbnailHeight uint64 `json:"thumbnail_height"`
	ThumbnailUrl    string `json:"thumbnail_url"`
	ProviderUrl     string `json:"provider_url"`
	ProviderName    string `json:"provider_name"`
}

Response contains all the embedded object properties

type TikTokService

type TikTokService struct {
	// contains filtered or unexported fields
}

TikTokService encapsulates settings for TikTok api calls

func NewTikTokService

func NewTikTokService() *TikTokService

NewTikTokService creates TikTokService with default settings

func (*TikTokService) Embed

func (s *TikTokService) Embed(params map[string]string) (*Response, error)

Embed allows you to get the embed code and additional information about the video associated with the webpage link provided

Jump to

Keyboard shortcuts

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