<commit_before>package net.serverpeon.twitcharchiver.twitch.api

import okhttp3.HttpUrl
import java.net.URLEncoder

/**
 * Usher is Twitch's content delivery system, it manages access to the streams
 */
object UsherApi {
    private val USHER_URL = HttpUrl.parse("https://usher.twitch.tv/vod/")
    private const val ALLOW_SOURCE_PARAM = "allow_source"
    private const val ALLOW_SPECTRE_PARAM = "allow_spectre"
    private const val PLAYER_PARAM = "player"
    private const val SIGNATURE_PARAM = "nauthsig"
    private const val TOKEN_PARAM = "nauth"

    /**
     * Constructs the url to the HLS playlist for the given broadcast
     * Requires [InternalApi.AccessResponse] for the given broadcastId
     */
    fun buildResourceUrl(broadcastId: Long, auth: InternalApi.AccessResponse): HttpUrl {
        return USHER_URL.newBuilder()
                .addPathSegment(broadcastId.toString())
                .addQueryParameter(ALLOW_SOURCE_PARAM, "true")
                .addQueryParameter(ALLOW_SPECTRE_PARAM, "true")
                .addQueryParameter(PLAYER_PARAM, "twitch-archiver")
                .addEncodedQueryParameter(SIGNATURE_PARAM, auth.signature.urlEncode())
                .addEncodedQueryParameter(TOKEN_PARAM, auth.token.urlEncode())
                .build()
    }

    private fun String.urlEncode(): String = URLEncoder.encode(this, "UTF-8")
}<commit_msg>Https is wrong.<commit_after>package net.serverpeon.twitcharchiver.twitch.api

import okhttp3.HttpUrl
import java.net.URLEncoder

/**
 * Usher is Twitch's content delivery system, it manages access to the streams
 */
object UsherApi {
    private val USHER_URL = HttpUrl.parse("http://usher.twitch.tv/vod/")
    private const val ALLOW_SOURCE_PARAM = "allow_source"
    private const val ALLOW_SPECTRE_PARAM = "allow_spectre"
    private const val PLAYER_PARAM = "player"
    private const val SIGNATURE_PARAM = "nauthsig"
    private const val TOKEN_PARAM = "nauth"

    /**
     * Constructs the url to the HLS playlist for the given broadcast
     * Requires [InternalApi.AccessResponse] for the given broadcastId
     */
    fun buildResourceUrl(broadcastId: Long, auth: InternalApi.AccessResponse): HttpUrl {
        return USHER_URL.newBuilder()
                .addPathSegment(broadcastId.toString())
                .addQueryParameter(ALLOW_SOURCE_PARAM, "true")
                .addQueryParameter(ALLOW_SPECTRE_PARAM, "true")
                .addQueryParameter(PLAYER_PARAM, "twitch-archiver")
                .addEncodedQueryParameter(SIGNATURE_PARAM, auth.signature.urlEncode())
                .addEncodedQueryParameter(TOKEN_PARAM, auth.token.urlEncode())
                .build()
    }

    private fun String.urlEncode(): String = URLEncoder.encode(this, "UTF-8")
}
{'fraction_non_alphanumeric': 0.09169989126495107, 'fraction_numerical': 0.0014498006524102935, 'mean_word_length': 3.1945288753799392, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3837730', 'n_tokens_mistral': 827, 'n_tokens_neox': 807, 'n_words': 186}