diff --git a/Core/src/main/java/me/zacharias/chat/core/Core.java b/Core/src/main/java/me/zacharias/chat/core/Core.java index 33a3f99..6b1c102 100644 --- a/Core/src/main/java/me/zacharias/chat/core/Core.java +++ b/Core/src/main/java/me/zacharias/chat/core/Core.java @@ -462,6 +462,10 @@ public class Core { */ public static void writeLog(String message) { + if(logWriter == null) { + System.err.println("!! Log writer is not initialized !!"); + return; + } try { LocalDateTime now = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd%EEEE HH:mm:ss'#'SSS"); diff --git a/GeniusAPI/src/main/java/me/zacharias/neuro/dock/genius/endpoints/GetLyrics.java b/GeniusAPI/src/main/java/me/zacharias/neuro/dock/genius/endpoints/GetLyrics.java index 0de4647..fb89c7e 100644 --- a/GeniusAPI/src/main/java/me/zacharias/neuro/dock/genius/endpoints/GetLyrics.java +++ b/GeniusAPI/src/main/java/me/zacharias/neuro/dock/genius/endpoints/GetLyrics.java @@ -49,7 +49,7 @@ public class GetLyrics extends GeniusEndpointTool { if(lyricsStr != null) { - // If we have a cached response, return it + return new OllamaToolRespnce(this.name(), lyricsStr.trim()); } JSONObject obj = geniusToolsInstance.getGeniusEndpoint("/songs/" + args[0].value(), null); @@ -57,7 +57,9 @@ public class GetLyrics extends GeniusEndpointTool { String lyrics_path = obj.getJSONObject("response").getJSONObject("song").getString("url"); try { Document doc = Jsoup.connect(lyrics_path) - .userAgent("Mozilla/5.0") + .userAgent("insomnia/11.1.0") // TODO: replace with somthing else then insomnia! since we in no way support what ever Insomnia's User-Agent says we do + .header("host", "genius.com") + .header("accept", "*/*") .get(); writeLog("Fetching lyrics from: " + lyrics_path);