export const findGetMediaUrlInTagblock = ( tagBlock: string): string | null => { const getMediaIndex = tagBlock.indexOf('get_media'); if (getMediaIndex === -1) { return null } const start = tagBlock.lastIndexOf('"', getMediaIndex); const end = tagBlock.indexOf('"', getMediaIndex); const substr = tagBlock.substring(start, end); if (substr.length > 0) { return substr.replace(/\\/g, '').replace(/"/g, ''); } return null } export const findGetRelatedUrlInTagblock = ( tagBlock: string): string | null => { const getMediaIndex = tagBlock.indexOf('player_related_datas'); if (getMediaIndex === -1) { return null } const start = tagBlock.lastIndexOf('"', getMediaIndex); const end = tagBlock.indexOf('"', getMediaIndex); const substr = tagBlock.substring(start, end); if (substr.length > 0) { return substr.replace(/\\/g, '').replace(/"/g, ''); } return null } export const createSessionCookie = (responseSetCookies: string[]): string => { let pieces: string[] = [] responseSetCookies.map((elem, key) => { if (elem.includes('platform=') || elem.includes('ss=') || elem.includes('fg_')) { pieces.push(elem.split(';')[0]) } }) const sessionCookie = pieces.join('; '); return sessionCookie }