| 815 | for (const line of lines) { |
| 816 | const [name, ...valueParts] = line.split("="); |
| 817 | const value = valueParts.join("="); |
| 818 | |
| 819 | if (name && value) { |
| 820 | const domain = ".youtube.com"; |
| 821 | const flag = "TRUE"; |
| 822 | const path = "/"; |
| 823 | const secure = "TRUE"; |
| 824 | const expiry = Math.floor(Date.now() / 1000) + 31536000; |
| 825 | |
| 826 | netscapeLines.push( |
| 827 | `${domain}\t${flag}\t${path}\t${secure}\t${expiry}\t${name.trim()}\t${value.trim()}` |
| 828 | ); |
| 829 | } |
| 830 | } |
| 831 | |
| 832 | return netscapeLines.join("\n"); |
| 833 | } |
| 834 | } |
| 835 | |
| 836 | // ==================== Helper Functions ==================== |
| 837 | async function extractSongInfo( |
| 838 | geminiResponse: string, |
| 839 | userInput: string |
| 840 | ): Promise<{ |
| 841 | title: string; |
| 842 | artist: string; |
| 843 | album?: string; |
| 844 | duration?: number; |
| 845 | }> { |
| 846 | const lines = geminiResponse.split("\n").map((line) => line.trim()); |
| 847 | let title = ""; |