All files / src constants.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14      2x                    
/**
 * Regular expressions and constants used for YouTube transcript fetching
 */
export const CONSTANTS = {
  /** Matches YouTube video URLs and extracts the video ID */
  VIDEO_ID_REGEX: /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/i,
  
  /** User agent string for making requests */
  USER_AGENT: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36,gzip(gfe)',
  
  /** Matches transcript XML format and extracts timing and text */
  TRANSCRIPT_XML_REGEX: /<text start="([^"]*)" dur="([^"]*)">([^<]*)<\/text>/g
};