This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* mediaId | |
* format and return only needed pieces of media from their public sources | |
* Author: Trevor Clarke, minor changes from Mark Watkins | |
*/ | |
function mediaId (){ | |
// http://www.youtube.com/embed/m5yCOSHeYn4 | |
var ytRegEx = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/; | |
// http://vimeo.com/3116167, https://player.vimeo.com/video/50489180, http://vimeo.com/channels/3116167, http://vimeo.com/channels/staffpicks/113544877 | |
var vmRegEx = /https?:\/\/(?:vimeo\.com\/|player\.vimeo\.com\/)(?:video\/|(?:channels\/staffpicks\/|channels\/)|)((\w|-){7,9})/; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GOOGLE_API_KEY = process.env.GOOGLE_API_KEY; // Ensure this is set as an environment variable | |
if (!GOOGLE_API_KEY) { | |
console.error("Error: GOOGLE_API_KEY environment variable is not set."); | |
process.exit(1); | |
} | |
// --- Prompt that governs the extraction --- | |
const defaultPrompt = `Tell me the music mentioned in the following text. | |
Order the artists by their importance in the article. |