mirror of
				https://github.com/TeamPiped/Piped-Backend.git
				synced 2024-08-14 23:51:41 +00:00 
			
		
		
		
	Don't fail hard when LBRY throws errors.
This commit is contained in:
		
							parent
							
								
									cad4e2cc33
								
							
						
					
					
						commit
						2c7baa0710
					
				
					 1 changed files with 12 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -121,7 +121,7 @@ public class ResponseHelper {
 | 
			
		|||
            try {
 | 
			
		||||
                return getLBRYId(videoId);
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                ExceptionUtils.rethrow(e);
 | 
			
		||||
                ExceptionHandler.handle(e);
 | 
			
		||||
            }
 | 
			
		||||
            return null;
 | 
			
		||||
        });
 | 
			
		||||
| 
						 | 
				
			
			@ -130,7 +130,7 @@ public class ResponseHelper {
 | 
			
		|||
            try {
 | 
			
		||||
                return getLBRYStreamURL(futureLbryId);
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                ExceptionUtils.rethrow(e);
 | 
			
		||||
                ExceptionHandler.handle(e);
 | 
			
		||||
            }
 | 
			
		||||
            return null;
 | 
			
		||||
        });
 | 
			
		||||
| 
						 | 
				
			
			@ -945,12 +945,16 @@ public class ResponseHelper {
 | 
			
		|||
        String lbryId = futureLbryId.get();
 | 
			
		||||
 | 
			
		||||
        if (!lbryId.isEmpty())
 | 
			
		||||
            return new JSONObject(Constants.h2client.send(HttpRequest
 | 
			
		||||
                    .newBuilder(URI.create("https://api.lbry.tv/api/v1/proxy?m=get"))
 | 
			
		||||
                    .POST(BodyPublishers.ofString(
 | 
			
		||||
                            String.valueOf(new JSONObject().put("jsonrpc", "2.0").put("method", "get").put("params",
 | 
			
		||||
                                    new JSONObject().put("uri", "lbry://" + lbryId).put("save_file", true)))))
 | 
			
		||||
                    .build(), BodyHandlers.ofString()).body()).getJSONObject("result").getString("streaming_url");
 | 
			
		||||
            return new JSONObject(
 | 
			
		||||
                    Constants.h2client.send(
 | 
			
		||||
                            HttpRequest.newBuilder(URI.create("https://api.lbry.tv/api/v1/proxy?m=get"))
 | 
			
		||||
                                    .POST(BodyPublishers.ofString(
 | 
			
		||||
                                            String.valueOf(new JSONObject().put("id", System.currentTimeMillis())
 | 
			
		||||
                                                    .put("jsonrpc", "2.0").put("method", "get").put("params",
 | 
			
		||||
                                                            new JSONObject().put("uri", "lbry://" + lbryId)
 | 
			
		||||
                                                                    .put("save_file", true)))))
 | 
			
		||||
                                    .build(),
 | 
			
		||||
                            BodyHandlers.ofString()).body()).getJSONObject("result").getString("streaming_url");
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue