mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Support for initial pages of other channel URL types.
This commit is contained in:
parent
3811a7f264
commit
5b77fbed1c
2 changed files with 18 additions and 3 deletions
|
@ -78,7 +78,22 @@ public class ServerLauncher extends MultithreadedHttpServerLauncher {
|
||||||
}
|
}
|
||||||
})).map("/channels/:channelId", AsyncServlet.ofBlocking(executor, request -> {
|
})).map("/channels/:channelId", AsyncServlet.ofBlocking(executor, request -> {
|
||||||
try {
|
try {
|
||||||
return getJsonResponse(ResponseHelper.channelResponse(request.getPathParameter("channelId")),
|
return getJsonResponse(
|
||||||
|
ResponseHelper.channelResponse("channel/" + request.getPathParameter("channelId")),
|
||||||
|
"public, max-age=600");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return getErrorResponse(e);
|
||||||
|
}
|
||||||
|
})).map("/c/:name", AsyncServlet.ofBlocking(executor, request -> {
|
||||||
|
try {
|
||||||
|
return getJsonResponse(ResponseHelper.channelResponse("c/" + request.getPathParameter("name")),
|
||||||
|
"public, max-age=600");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return getErrorResponse(e);
|
||||||
|
}
|
||||||
|
})).map("/user/:name", AsyncServlet.ofBlocking(executor, request -> {
|
||||||
|
try {
|
||||||
|
return getJsonResponse(ResponseHelper.channelResponse("user/" + request.getPathParameter("name")),
|
||||||
"public, max-age=600");
|
"public, max-age=600");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return getErrorResponse(e);
|
return getErrorResponse(e);
|
||||||
|
|
|
@ -166,9 +166,9 @@ public class ResponseHelper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final byte[] channelResponse(String channelId) throws Exception {
|
public static final byte[] channelResponse(String channelPath) throws Exception {
|
||||||
|
|
||||||
final ChannelInfo info = ChannelInfo.getInfo("https://youtube.com/channel/" + channelId);
|
final ChannelInfo info = ChannelInfo.getInfo("https://youtube.com/" + channelPath);
|
||||||
|
|
||||||
final List<StreamItem> relatedStreams = new ObjectArrayList<>();
|
final List<StreamItem> relatedStreams = new ObjectArrayList<>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue