Skip to content

Latest commit

 

History

History
474 lines (350 loc) · 16.1 KB

API.md

File metadata and controls

474 lines (350 loc) · 16.1 KB

Classes

TekstowoAPIRequestOptions
TekstowoAPISearchResults
TekstowoAPIArtistProfile
TekstowoAPILyrics
TekstowoAPI
KVPair

Functions

AutomaticSortDirection(sortMode)
parseDate(input)
parseComments(htmlString)
getDuplicates(arr)Array
constructObject(keys, values)Object
findClosestString(distances)DistanceCompareResult
levenshteinDistanceArray(strArray, targetStr)Array.<Distance>
levenshteinDistance(str1, str2)number
unescapeJsonString(jsonString)string
unescapeHtmlString(htmlString)string
getTextBetween(text, start, end)Array.<string>

Typedefs

TekstowoAPILyricsID : String
TekstowoAPIArtistID : String
TekstowoAPILyricsMetadata

just an Object

Distance
DistanceCompareResult

TekstowoAPIRequestOptions

Kind: global class

new TekstowoAPIRequestOptions(url, fetchOptions)

Param Type
url string
fetchOptions RequestInit

TekstowoAPISearchResults

Kind: global class

new TekstowoAPISearchResults(songs, artists, pageCount)

Param Type
songs Object.<string, TekstowoAPILyricsID>
artists Object.<string, TekstowoAPIArtistID>
pageCount number

TekstowoAPIArtistProfile

Kind: global class

new TekstowoAPIArtistProfile(displayName, artistDescription, images, discography, commentCount, internalId)

Param Type
displayName string
artistDescription string
images Array.<{hd: string, small: string}>
discography Array.<{year: number, name: string}>
commentCount number | undefined
internalId string | undefined

TekstowoAPILyrics

Kind: global class

new TekstowoAPILyrics(original, translated, metadata, lyricsName, video, internalId, [aiGeneratedTranslation], commentCount)

Param Type Default Description
original string
translated string
metadata Object
lyricsName string
video string YouTube video ID
internalId string ID used by vote system or comments
[aiGeneratedTranslation] boolean false Is the translation made by AI?
commentCount number | undefined How many comments are on this lyrics page?

TekstowoAPI

Kind: global class

new TekstowoAPI(FetchImpl, proxyMetod)

Creates a new TekstowoAPI instance

Param Type
FetchImpl fetch
proxyMetod TekstowoAPIProxyMethods

tekstowoAPI.FetchImpl : fetch

Kind: instance property of TekstowoAPI

tekstowoAPI.ConstantURLPaths : ConstantURLPaths

Kind: instance property of TekstowoAPI

tekstowoAPI.makeRequest(options) ⇒ Promise.<Response>

Makes a request using TekstowoAPI#FetchImpl.

Kind: instance method of TekstowoAPI
See: TekstowoAPI#FetchImpl

Param Type
options TekstowoAPIRequestOptions

tekstowoAPI.proxyThisUrl(url) ⇒ string

Selects a proxy using TekstowoAPI#proxyMetod.

Kind: instance method of TekstowoAPI
See: TekstowoAPI#proxyMetod

Param Type
url string

tekstowoAPI.extractLyrics(songId, options) ⇒ Promise.<(TekstowoAPILyrics|null)>

Downloads and parses lyrics page for specified arguments.

Kind: instance method of TekstowoAPI

Param Type Description
songId TekstowoAPILyricsID
options Object Options for extraction. Providing a boolean here is deprecated.
options.withMetadata boolean
options.withVideoId boolean

tekstowoAPI.searchLyrics(artist, songName, page, includePageCount) ⇒ Promise.<Object.<string, TekstowoAPILyricsID>>

Deprecated

Downloads and parses search result page for specified arguments.

Kind: instance method of TekstowoAPI

Param Type Default Description
artist string
songName string
page number
includePageCount boolean false Adds undocumented property, "INTERNAL_PAGE_COUNT" (not-enumerable) with value returned by TekstowoAPI#getPagesForSong.

tekstowoAPI.search(query, options) ⇒ Promise.<(Object.<string, (TekstowoAPILyricsID|TekstowoAPIArtistID)>|TekstowoAPISearchResults)>

Downloads and parses search result page for specified arguments.

Kind: instance method of TekstowoAPI

Param Type Description
query string
options Object
options.page number
options.includePageCount boolean If onlyArtists or onlySongs is true, adds undocumented property, "INTERNAL_PAGE_COUNT" (not-enumerable) with value returned by TekstowoAPI#getPagesForSong. If not, sets the pageCount property of TekstowoAPISearchResults.
options.onlyArtists boolean If true, skips extracting songs and returns only artist list.
options.onlySongs boolean If true, skips extracting artists and returns only song list.

tekstowoAPI.getPagesForSong()

Deprecated

Kind: instance method of TekstowoAPI

tekstowoAPI.getPagesForQuery(query, skipFetch, from) ⇒ Promise.<number>

Downloads and parses search result page and extracts pages count for specified arguments. Alternatively, if skipFetch is not empty (""), re-fetching will be skipped and it will use the supplied HTML string.

Kind: instance method of TekstowoAPI

Param Type Default Description
query string
skipFetch string
from number 1 Debug only, don't use

tekstowoAPI.getLyrics(artist, songName) ⇒ Promise.<(TekstowoAPILyrics|null)>

Downloads and parses search result page, then from list of results selects closest name match for specified arguments.

Kind: instance method of TekstowoAPI

Param Type
artist string
songName string

tekstowoAPI.getMetadata(songIdOrHtml, useHTML) ⇒ Promise.<(TekstowoAPILyricsMetadata|null)>

Downloads, parses lyrics page and extracts "metrics" section for specified arguments. Alternatively, if useHTML is true, accepts HTML string from songIdOrHtml.

Kind: instance method of TekstowoAPI

Param Type Default
songIdOrHtml TekstowoAPILyricsID | string
useHTML Boolean false

tekstowoAPI.getArtistsSongList(artistId, options) ⇒ Promise.<{pageCount: number, results: Array.<KVPair.<string, TekstowoAPIArtistID>>}>

Downloads and parses artist song list

Kind: instance method of TekstowoAPI

Param Type
artistId TekstowoAPIArtistID
options Object
options.page number
options.sortDir string
options.sortMode string

tekstowoAPI.requestComments(internalId, offset, mode)

Kind: instance method of TekstowoAPI

Param Type Default Description
internalId string The post id we are pulling comments for. Can be song id, artist id.
offset * 0 How many comments have we already acknowledged?
mode * S What type is the post? 'S' for songs, 'A' for artists.

KVPair

Kind: global class

new KVPair(key, value)

Param Type
key K
value V

TekstowoAPIProxyMethods : enum

Kind: global enum
Properties

Name Type Default
None number 0
AllOrigins number 1
SirJoshProxy number 2

AutomaticSortDirection(sortMode)

Kind: global function

Param Type
sortMode string

parseDate(input)

Kind: global function

Param Type
input string

parseComments(htmlString)

Kind: global function

Param Type
htmlString string

getDuplicates(arr) ⇒ Array

Kind: global function

Param Type
arr Array

constructObject(keys, values) ⇒ Object

Kind: global function

Param Type
keys Array
values Array

findClosestString(distances) ⇒ DistanceCompareResult

Kind: global function

Param Type
distances Array.<Distance>

levenshteinDistanceArray(strArray, targetStr) ⇒ Array.<Distance>

Kind: global function

Param Type
strArray Array.<string>
targetStr string

levenshteinDistance(str1, str2) ⇒ number

Kind: global function

Param Type
str1 string
str2 string

levenshteinDistance~dp : Array.<Array.<number>>

Kind: inner constant of levenshteinDistance

unescapeJsonString(jsonString) ⇒ string

Kind: global function

Param Type
jsonString string

unescapeHtmlString(htmlString) ⇒ string

Kind: global function

Param Type
htmlString string

getTextBetween(text, start, end) ⇒ Array.<string>

Kind: global function

Param Type
text string
start string
end string

TekstowoAPILyricsID : String

Kind: global typedef

TekstowoAPIArtistID : String

Kind: global typedef

TekstowoAPILyricsMetadata

just an Object

Kind: global typedef

Distance

Kind: global typedef
Properties

Name Type
str string
distance number

DistanceCompareResult

Kind: global typedef
Properties

Name Type
closestString string
lowestDistance number

Generated by awesome jsdoc-to-markdown