<commit_before>import { getOption } from '../persistence/store';

export function prepareUrl (url) {
  return `${url}&key=${ getOption('yt.apiKey')}`;
}

export function trackSearch (track) {
  return fetch(prepareUrl('https://www.googleapis.com/youtube/v3/search?part=id,snippet&type=video&maxResults=50&q=' + encodeURIComponent(track)));
}<commit_msg>Youtube api key fallback<commit_after>import { getOption } from '../persistence/store';
import { ytApiKey } from '../globals';

export function prepareUrl (url) {
  return `${url}&key=${ getOption('yt.apiKey') || ytApiKey }`;
}

export function trackSearch (track) {
  return fetch(prepareUrl('https://www.googleapis.com/youtube/v3/search?part=id,snippet&type=video&maxResults=50&q=' + encodeURIComponent(track)));
}
{'fraction_non_alphanumeric': 0.17685305591677503, 'fraction_numerical': 0.007802340702210663, 'mean_word_length': 6.7, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6874171', 'n_tokens_mistral': 248, 'n_tokens_neox': 250, 'n_words': 44}