Documentation
¶
Index ¶
- Constants
- type AccountInfo
- type AsyncTranscript
- type Config
- type ConfigOption
- type CrawlBody
- type CrawlJob
- type CrawlPage
- type CrawlResult
- type CrawlStatus
- type ErrorIdentifier
- type ErrorResponse
- type MapParams
- type MapResult
- type Metadata
- type MetadataPlatform
- type MetadataType
- type ScrapeParams
- type ScrapeResult
- type Supadata
- func (s *Supadata) Crawl(params *CrawlBody) (*CrawlJob, error)
- func (s *Supadata) CrawlResult(jobId string, skip int) (*CrawlResult, error)
- func (s *Supadata) Map(params *MapParams) (*MapResult, error)
- func (s *Supadata) Me() (*AccountInfo, error)
- func (s *Supadata) Metadata(url string) (*Metadata, error)
- func (s *Supadata) Scrape(params *ScrapeParams) (*ScrapeResult, error)
- func (s *Supadata) Transcript(params *TranscriptParams) (*Transcript, error)
- func (s *Supadata) TranscriptResult(jobId string) (*TranscriptResult, error)
- func (s *Supadata) YouTubeBatchResult(jobId string) (*YouTubeBatchResult, error)
- func (s *Supadata) YouTubeChannel(id string) (*YouTubeChannel, error)
- func (s *Supadata) YouTubeChannelVideos(params *YouTubeChannelVideosParams) (*YouTubeChannelVideosResult, error)
- func (s *Supadata) YouTubePlaylist(id string) (*YouTubePlaylist, error)
- func (s *Supadata) YouTubePlaylistVideos(params *YouTubePlaylistVideosParams) (*YouTubePlaylistVideosResult, error)
- func (s *Supadata) YouTubeSearch(params *YouTubeSearchParams) (*YouTubeSearchResult, error)
- func (s *Supadata) YouTubeTranscript(params *YouTubeTranscriptParams) (*YouTubeTranscriptResult, error)
- func (s *Supadata) YouTubeTranscriptBatch(params *YouTubeTranscriptBatchParams) (*YouTubeBatchJob, error)
- func (s *Supadata) YouTubeTranscriptTranslate(params *YouTubeTranscriptTranslateParams) (*YouTubeTranscriptTranslateResult, error)
- func (s *Supadata) YouTubeVideo(id string) (*YouTubeVideo, error)
- func (s *Supadata) YouTubeVideoBatch(params *YouTubeVideoBatchParams) (*YouTubeBatchJob, error)
- type SyncTranscript
- type Transcript
- type TranscriptContent
- type TranscriptModeParam
- type TranscriptParams
- type TranscriptResult
- type TranscriptResultStatus
- type YouTubeBatchJob
- type YouTubeBatchResult
- type YouTubeBatchResultItem
- type YouTubeBatchStats
- type YouTubeBatchStatus
- type YouTubeChannel
- type YouTubeChannelVideoType
- type YouTubeChannelVideosParams
- type YouTubeChannelVideosResult
- type YouTubePlaylist
- type YouTubePlaylistVideosParams
- type YouTubePlaylistVideosResult
- type YouTubeSearchDuration
- type YouTubeSearchFeature
- type YouTubeSearchParams
- type YouTubeSearchResult
- type YouTubeSearchResultItem
- type YouTubeSearchSortBy
- type YouTubeSearchType
- type YouTubeSearchUploadDate
- type YouTubeTranscriptBatchParams
- type YouTubeTranscriptParams
- type YouTubeTranscriptResult
- type YouTubeTranscriptTranslateParams
- type YouTubeTranscriptTranslateResult
- type YouTubeVideo
- type YouTubeVideoBatchParams
- type YouTubeVideoChannel
Constants ¶
const (
BaseUrl = "https://api.supadata.ai/v1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶ added in v0.1.4
type AsyncTranscript ¶
type AsyncTranscript struct {
JobId string `json:"jobId"`
}
type ConfigOption ¶ added in v0.1.3
type ConfigOption func(*Config)
func WithAPIKey ¶
func WithAPIKey(apiKey string) ConfigOption
func WithBaseURL ¶ added in v0.1.3
func WithBaseURL(baseURL string) ConfigOption
func WithClient ¶
func WithClient(client *http.Client) ConfigOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ConfigOption
type CrawlResult ¶ added in v0.1.4
type CrawlResult struct {
Status CrawlStatus `json:"status"`
Pages []CrawlPage `json:"pages,omitempty"`
Next string `json:"next,omitempty"`
}
type CrawlStatus ¶ added in v0.1.4
type CrawlStatus string
CrawlStatus represents the status of a crawl job
const ( Scraping CrawlStatus = "scraping" CrawlCompleted CrawlStatus = "completed" CrawlFailed CrawlStatus = "failed" Cancelled CrawlStatus = "cancelled" )
type ErrorIdentifier ¶
type ErrorIdentifier string
const ( InvalidRequest ErrorIdentifier = "invalid-request" InternalError ErrorIdentifier = "internal-error" Forbidden ErrorIdentifier = "forbidden" UpgradeRequired ErrorIdentifier = "upgrade-required" NotFound ErrorIdentifier = "not-found" LimitExceeded ErrorIdentifier = "limit-exceeded" )
type ErrorResponse ¶
type ErrorResponse struct {
ErrorIdentifier ErrorIdentifier `json:"error"`
Message string `json:"message"`
Details string `json:"details"`
DocumentationUrl string `json:"documentationUrl"`
}
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type Metadata ¶
type Metadata struct {
Platform MetadataPlatform `json:"platform"`
Type MetadataType `json:"type"`
Id string `json:"id"`
Url string `json:"url"`
Title string `json:"title"`
Description string `json:"description"`
Author struct {
DisplayName string `json:"displayName"`
Username string `json:"username"`
AvatarUrl string `json:"avatarUrl"`
Verified bool `json:"verified"`
} `json:"author"`
Stats struct {
Likes *int `json:"likes"`
Comments *int `json:"comments"`
Shares *int `json:"shares"`
Views *int `json:"views"`
} `json:"stats"`
Media struct {
Type string `json:"type"`
Duration float64 `json:"duration,omitempty"`
ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
Url string `json:"url,omitempty"`
Items []struct {
Type string `json:"type"`
Duration float64 `json:"duration,omitempty"`
ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
Url string `json:"url,omitempty"`
} `json:"items,omitempty"`
} `json:"media"`
Tags []string `json:"tags,omitempty"`
CreatedAt time.Time `json:"createdAt"`
AdditionalData map[string]any `json:"additionalData,omitempty"`
}
type MetadataPlatform ¶
type MetadataPlatform string
const ( YouTube MetadataPlatform = "youtube" TikTok MetadataPlatform = "tiktok" Instagram MetadataPlatform = "instagram" Twitter MetadataPlatform = "twitter" Facebook MetadataPlatform = "facebook" )
type MetadataType ¶
type MetadataType string
const ( Video MetadataType = "video" Image MetadataType = "image" Carousel MetadataType = "carousel" Post MetadataType = "post" )
type ScrapeParams ¶ added in v0.1.4
type ScrapeResult ¶ added in v0.1.4
type Supadata ¶
type Supadata struct {
// contains filtered or unexported fields
}
func NewSupadata ¶
func NewSupadata(opts ...ConfigOption) *Supadata
func (*Supadata) CrawlResult ¶ added in v0.1.4
func (s *Supadata) CrawlResult(jobId string, skip int) (*CrawlResult, error)
CrawlResult retrieves the status and results of a crawl job
func (*Supadata) Me ¶ added in v0.1.4
func (s *Supadata) Me() (*AccountInfo, error)
Me retrieves account information
func (*Supadata) Scrape ¶ added in v0.1.4
func (s *Supadata) Scrape(params *ScrapeParams) (*ScrapeResult, error)
Scrape extracts content from a webpage as markdown
func (*Supadata) Transcript ¶
func (s *Supadata) Transcript(params *TranscriptParams) (*Transcript, error)
Transcript initiates a transcript request (sync or async)
func (*Supadata) TranscriptResult ¶
func (s *Supadata) TranscriptResult(jobId string) (*TranscriptResult, error)
TranscriptResult retrieves the result of an async transcript job
func (*Supadata) YouTubeBatchResult ¶ added in v0.1.4
func (s *Supadata) YouTubeBatchResult(jobId string) (*YouTubeBatchResult, error)
YouTubeBatchResult retrieves the status and results of a batch job
func (*Supadata) YouTubeChannel ¶ added in v0.1.4
func (s *Supadata) YouTubeChannel(id string) (*YouTubeChannel, error)
YouTubeChannel retrieves metadata for a YouTube channel
func (*Supadata) YouTubeChannelVideos ¶ added in v0.1.4
func (s *Supadata) YouTubeChannelVideos(params *YouTubeChannelVideosParams) (*YouTubeChannelVideosResult, error)
YouTubeChannelVideos retrieves video IDs from a YouTube channel
func (*Supadata) YouTubePlaylist ¶ added in v0.1.4
func (s *Supadata) YouTubePlaylist(id string) (*YouTubePlaylist, error)
YouTubePlaylist retrieves metadata for a YouTube playlist
func (*Supadata) YouTubePlaylistVideos ¶ added in v0.1.4
func (s *Supadata) YouTubePlaylistVideos(params *YouTubePlaylistVideosParams) (*YouTubePlaylistVideosResult, error)
YouTubePlaylistVideos retrieves video IDs from a YouTube playlist
func (*Supadata) YouTubeSearch ¶ added in v0.1.4
func (s *Supadata) YouTubeSearch(params *YouTubeSearchParams) (*YouTubeSearchResult, error)
YouTubeSearch searches YouTube for videos, channels, or playlists
func (*Supadata) YouTubeTranscript ¶ added in v0.1.4
func (s *Supadata) YouTubeTranscript(params *YouTubeTranscriptParams) (*YouTubeTranscriptResult, error)
YouTubeTranscript retrieves the transcript for a YouTube video
func (*Supadata) YouTubeTranscriptBatch ¶ added in v0.1.4
func (s *Supadata) YouTubeTranscriptBatch(params *YouTubeTranscriptBatchParams) (*YouTubeBatchJob, error)
YouTubeTranscriptBatch initiates a batch job to retrieve transcripts for multiple videos
func (*Supadata) YouTubeTranscriptTranslate ¶ added in v0.1.4
func (s *Supadata) YouTubeTranscriptTranslate(params *YouTubeTranscriptTranslateParams) (*YouTubeTranscriptTranslateResult, error)
YouTubeTranscriptTranslate retrieves a translated transcript for a YouTube video
func (*Supadata) YouTubeVideo ¶ added in v0.1.4
func (s *Supadata) YouTubeVideo(id string) (*YouTubeVideo, error)
YouTubeVideo retrieves metadata for a YouTube video
func (*Supadata) YouTubeVideoBatch ¶ added in v0.1.4
func (s *Supadata) YouTubeVideoBatch(params *YouTubeVideoBatchParams) (*YouTubeBatchJob, error)
YouTubeVideoBatch initiates a batch job to retrieve multiple video metadata
type SyncTranscript ¶
type SyncTranscript struct {
Content []TranscriptContent `json:"content"`
Lang string `json:"lang"`
AvailableLangs []string `json:"availableLangs"`
}
type Transcript ¶
type Transcript struct {
Sync *SyncTranscript
Async *AsyncTranscript
}
func (*Transcript) IsAsync ¶
func (r *Transcript) IsAsync() bool
type TranscriptContent ¶
type TranscriptModeParam ¶
type TranscriptModeParam string
const ( Native TranscriptModeParam = "native" Auto TranscriptModeParam = "auto" Generate TranscriptModeParam = "generate" )
type TranscriptParams ¶
type TranscriptParams struct {
Url string
Lang string
Text bool
ChunkSize int
Mode TranscriptModeParam
}
type TranscriptResult ¶
type TranscriptResult struct {
Status TranscriptResultStatus `json:"status"`
Error *ErrorResponse `json:"error,omitempty"`
Content []TranscriptContent `json:"content,omitempty"`
Lang string `json:"lang,omitempty"`
AvailableLangs []string `json:"availableLangs,omitempty"`
}
type TranscriptResultStatus ¶
type TranscriptResultStatus string
const ( Queued TranscriptResultStatus = "queued" Active TranscriptResultStatus = "active" Completed TranscriptResultStatus = "completed" Failed TranscriptResultStatus = "failed" )
type YouTubeBatchJob ¶ added in v0.1.4
type YouTubeBatchJob struct {
JobId string `json:"jobId"`
}
type YouTubeBatchResult ¶ added in v0.1.4
type YouTubeBatchResult struct {
Status YouTubeBatchStatus `json:"status"`
Results []YouTubeBatchResultItem `json:"results,omitempty"`
Stats YouTubeBatchStats `json:"stats"`
CompletedAt *string `json:"completedAt,omitempty"`
}
type YouTubeBatchResultItem ¶ added in v0.1.4
type YouTubeBatchResultItem struct {
VideoId string `json:"videoId"`
Transcript *YouTubeTranscriptResult `json:"transcript,omitempty"`
Video *YouTubeVideo `json:"video,omitempty"`
ErrorCode string `json:"errorCode,omitempty"`
}
type YouTubeBatchStats ¶ added in v0.1.4
type YouTubeBatchStatus ¶ added in v0.1.4
type YouTubeBatchStatus string
YouTubeBatchStatus represents the status of a batch job
const ( BatchQueued YouTubeBatchStatus = "queued" BatchActive YouTubeBatchStatus = "active" BatchCompleted YouTubeBatchStatus = "completed" BatchFailed YouTubeBatchStatus = "failed" )
type YouTubeChannel ¶ added in v0.1.4
type YouTubeChannel struct {
Id string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
SubscriberCount *int `json:"subscriberCount,omitempty"`
VideoCount *int `json:"videoCount,omitempty"`
ViewCount *int `json:"viewCount,omitempty"`
Thumbnail string `json:"thumbnail,omitempty"`
Banner string `json:"banner,omitempty"`
}
type YouTubeChannelVideoType ¶ added in v0.1.4
type YouTubeChannelVideoType string
YouTubeChannelVideoType filter for channel videos
const ( ChannelVideoTypeAll YouTubeChannelVideoType = "all" ChannelVideoTypeVideo YouTubeChannelVideoType = "video" ChannelVideoTypeShort YouTubeChannelVideoType = "short" ChannelVideoTypeLive YouTubeChannelVideoType = "live" )
type YouTubeChannelVideosParams ¶ added in v0.1.4
type YouTubeChannelVideosParams struct {
Id string
Limit int
Type YouTubeChannelVideoType
}
type YouTubeChannelVideosResult ¶ added in v0.1.4
type YouTubePlaylist ¶ added in v0.1.4
type YouTubePlaylist struct {
Id string `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
VideoCount int `json:"videoCount"`
ViewCount *int `json:"viewCount,omitempty"`
LastUpdated *string `json:"lastUpdated,omitempty"`
Channel YouTubeVideoChannel `json:"channel"`
}
type YouTubePlaylistVideosParams ¶ added in v0.1.4
type YouTubePlaylistVideosResult ¶ added in v0.1.4
type YouTubeSearchDuration ¶ added in v0.1.4
type YouTubeSearchDuration string
YouTubeSearchDuration filter for search results
const ( DurationAll YouTubeSearchDuration = "all" DurationShort YouTubeSearchDuration = "short" DurationMedium YouTubeSearchDuration = "medium" DurationLong YouTubeSearchDuration = "long" )
type YouTubeSearchFeature ¶ added in v0.1.4
type YouTubeSearchFeature string
YouTubeSearchFeature special features filter
const ( FeatureHD YouTubeSearchFeature = "hd" FeatureSubtitles YouTubeSearchFeature = "subtitles" FeatureCreativeCommon YouTubeSearchFeature = "creative-commons" Feature3D YouTubeSearchFeature = "3d" FeatureLive YouTubeSearchFeature = "live" Feature4K YouTubeSearchFeature = "4k" Feature360 YouTubeSearchFeature = "360" FeatureLocation YouTubeSearchFeature = "location" FeatureHDR YouTubeSearchFeature = "hdr" FeatureVR180 YouTubeSearchFeature = "vr180" )
type YouTubeSearchParams ¶ added in v0.1.4
type YouTubeSearchParams struct {
Query string
UploadDate YouTubeSearchUploadDate
Type YouTubeSearchType
Duration YouTubeSearchDuration
SortBy YouTubeSearchSortBy
Features []YouTubeSearchFeature
Limit int
NextPageToken string
}
type YouTubeSearchResult ¶ added in v0.1.4
type YouTubeSearchResult struct {
Query string `json:"query"`
Results []YouTubeSearchResultItem `json:"results"`
TotalResults int `json:"totalResults"`
NextPageToken string `json:"nextPageToken,omitempty"`
}
type YouTubeSearchResultItem ¶ added in v0.1.4
type YouTubeSearchResultItem struct {
Type string `json:"type"`
Id string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Thumbnail string `json:"thumbnail"`
Duration int `json:"duration,omitempty"`
ViewCount *int `json:"viewCount,omitempty"`
UploadDate string `json:"uploadDate,omitempty"`
ChannelId string `json:"channelId,omitempty"`
ChannelName string `json:"channelName,omitempty"`
SubscriberCount *int `json:"subscriberCount,omitempty"`
VideoCount *int `json:"videoCount,omitempty"`
}
type YouTubeSearchSortBy ¶ added in v0.1.4
type YouTubeSearchSortBy string
YouTubeSearchSortBy sort order for search results
const ( SortByRelevance YouTubeSearchSortBy = "relevance" SortByRating YouTubeSearchSortBy = "rating" SortByDate YouTubeSearchSortBy = "date" SortByViews YouTubeSearchSortBy = "views" )
type YouTubeSearchType ¶ added in v0.1.4
type YouTubeSearchType string
YouTubeSearchType filter for search results
const ( SearchTypeAll YouTubeSearchType = "all" SearchTypeVideo YouTubeSearchType = "video" SearchTypeChannel YouTubeSearchType = "channel" SearchTypePlaylist YouTubeSearchType = "playlist" SearchTypeMovie YouTubeSearchType = "movie" )
type YouTubeSearchUploadDate ¶ added in v0.1.4
type YouTubeSearchUploadDate string
YouTubeSearchUploadDate filter for search results
const ( UploadDateAll YouTubeSearchUploadDate = "all" UploadDateHour YouTubeSearchUploadDate = "hour" UploadDateToday YouTubeSearchUploadDate = "today" UploadDateWeek YouTubeSearchUploadDate = "week" UploadDateMonth YouTubeSearchUploadDate = "month" UploadDateYear YouTubeSearchUploadDate = "year" )
type YouTubeTranscriptBatchParams ¶ added in v0.1.4
type YouTubeTranscriptParams ¶ added in v0.1.4
type YouTubeTranscriptResult ¶ added in v0.1.4
type YouTubeTranscriptResult struct {
Content []TranscriptContent `json:"content"`
Lang string `json:"lang"`
AvailableLangs []string `json:"availableLangs"`
}
type YouTubeTranscriptTranslateParams ¶ added in v0.1.4
type YouTubeTranscriptTranslateResult ¶ added in v0.1.4
type YouTubeTranscriptTranslateResult struct {
Content []TranscriptContent `json:"content"`
Lang string `json:"lang"`
}
type YouTubeVideo ¶ added in v0.1.4
type YouTubeVideo struct {
Id string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Duration int `json:"duration"`
Channel YouTubeVideoChannel `json:"channel"`
Tags []string `json:"tags"`
Thumbnail string `json:"thumbnail"`
UploadDate *string `json:"uploadDate"`
ViewCount *int `json:"viewCount"`
LikeCount *int `json:"likeCount"`
TranscriptLanguages []string `json:"transcriptLanguages"`
}