Service Api's


package main

import (
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"net/url"
)

const (
	apiKey    = "YOUR API"
	videoURL  = "URL FACEBOOK"
	endpoint  = "https://senpai-bot.store/facebookdl"
)

type Result struct {
	CommentCount interface{} `json:"comment_count"`
	Duration     interface{} `json:"duration"`
	Ext          string      `json:"ext"`
	LikeCount    interface{} `json:"like_count"`
	PostURL      string      `json:"post_url"`
	Thumbnail    interface{} `json:"thumbnail"`
	Title        string      `json:"title"`
	UploadDate   string      `json:"upload_date"`
	Uploader     string      `json:"uploader"`
	VideoURL     string      `json:"video_url"`
	ViewCount    interface{} `json:"view_count"`
}

type ApiResponse struct {
	Code   int    `json:"code"`
	Result Result `json:"result"`
}

func main() {
	encodedVideoURL := url.QueryEscape(videoURL)
	fullURL := fmt.Sprintf("%s?apikey=%s&url=%s", endpoint, apiKey, encodedVideoURL)

	resp, err := http.Get(fullURL)
	if err != nil {
		log.Fatalf("Error making request: %v", err)
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatalf("Error reading response: %v", err)
	}

	var response ApiResponse
	if err := json.Unmarshal(body, &response); err != nil {
		log.Fatalf("Error parsing JSON: %v", err)
	}

	if response.Code != 200 {
		log.Fatalf("API returned error code: %d", response.Code)
	}

	r := response.Result
	fmt.Println("Title       :", r.Title)
	fmt.Println("Uploader    :", r.Uploader)
	fmt.Println("Upload Date :", r.UploadDate)
	fmt.Println("Extension   :", r.Ext)
	fmt.Println("Post URL    :", r.PostURL)
	fmt.Println("Video URL   :", r.VideoURL)

	if r.Thumbnail != nil {
		fmt.Println("Thumbnail   :", r.Thumbnail)
	} else {
		fmt.Println("Thumbnail   : (null)")
	}

	if r.Duration != nil {
		fmt.Println("Duration    :", r.Duration)
	} else {
		fmt.Println("Duration    : (null)")
	}

	if r.LikeCount != nil {
		fmt.Println("Likes       :", r.LikeCount)
	} else {
		fmt.Println("Likes       : (null)")
	}

	if r.CommentCount != nil {
		fmt.Println("Comments    :", r.CommentCount)
	} else {
		fmt.Println("Comments    : (null)")
	}

	if r.ViewCount != nil {
		fmt.Println("Views       :", r.ViewCount)
	} else {
		fmt.Println("Views       : (null)")
	}
}