Skip to content

Commit

Permalink
temp disable comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluscream committed Apr 4, 2024
1 parent 532194a commit a4e4bfa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 45 deletions.
2 changes: 1 addition & 1 deletion sources/bluscream-pietsmietde/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"iconUrl": "https://raw.githubusercontent.com/Bluscream/grayjay-source-pietsmietde/master/icon.svg",
"id": "82b8fefc-24ae-11ee-be56-0242aa120002",

"scriptSignature": "BcKiw6zigb9BMcO5YE3DlhN8Z0Yo4paTEcOpwqHilZzDqT/CsjVZw6bOpuKVkcOWEuKVljLDqwjilZoeYMK/w67ilZzilakA4pWd4pSsBsOHXuKUgGXilpAIYcOnw6/ilIx4YeKVkuKMkBkDNQJR4pWa4pWQUc6xOOKUnM6xZsO7EirDqhTiiaVf4pSkCSbilZTDp+KVoQzilJgh4pSYzrXDh3d/zrEJQMK9w7Rfw7PDhDXilpPiladrdOKVpsK9G0hZJeKVqXtJ E0kpzqPilJzDqMOmw69gDBxKYcOoLcOy4pWpz4DijKFwwrAVJ3nilIzilatG4pWg4paMw5EfWhrilpPilarilpHDsuKCp8K/ 4pSYNjDigb/DhVfilZc7w5ZYGMKieOKVl1kd4pS0FeKVolxM4pWbwqvilZp64paAd8O3X8Kwec6j4omkVhZhw7pPJHnilZhKVFPilKwiAeKVmMK8f+KVms6mJ+KUrDowSuKMoeKVpOKUlOKUtHvilZhmw6k0w5/ilZfiloQj4pWcbeKUvMK1LuKVlM6xw7MyA+KWgB814paQNMKr4pWiHcOpBy7ilatmwrFcwrvilZLDvMOGzrTilZnDnAnDtMK6w7TilaV1WBrigqfilaTijKHDpeKWkwvDuuKUnBDDkSniiKlt4pWUwrUCYOKVmQB0CErilJxiwqHGkuKVmmA/OGhKIgHOmGRySx0Q4pWnz4PilZdqR8KsfWIHw7wowqXOtTnDv+KJoXLDh8O8Wi3ilLwL4pWkxpLDkQHDqR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xY5MZXaUhlvMDkz/oBE5baOSDqMZcthK27Hbu5ubSmFXh3PqpH3qhDsezDyHtV9sCCHMuHEdkKMkbP67FBfGxSfVa8uu5ZJdw5ixYKrP7XhavZ6cMmyWNmSFnZo3vo8pMHhAcUekXVwq/Yko+TV27015Btsyrp80j+HqmfPhVSvRXzimr3pU9ZPLu1Bc/KyYe36i3xA+Ux9N8IhCMaEd8tC+91A+tB6PnsZcSdlzif5b9NdsY4pADLzNRpbmSD3nG9z0b8YPys3i73QDieMDazQgWVucpaXbFfyyG8VhT0O2+58aATfzkMZfPdVU4xSRztv/bEBqJUjHEecPhl4XgUHDRBENpeQA0MhihOFakZJcq/KMXauvBJVywibQh5QTClQSNlMiTIEpL4b/HLO9DlyhaMSxsdM+f9iVE42Tr8BnTA49GeRtyBpt1KiUfoPlIDkHgt6JaVHy9oNtA91naSw/BGf8dlO7ISXhQyQ6nImpxAgMBAAE=",

"packages": ["Http"],
Expand Down
84 changes: 40 additions & 44 deletions sources/bluscream-pietsmietde/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,57 +188,53 @@ source.getContentDetails = function(url) {

};

function getCommentResults(contextUrl, page) {
const video_id = parseVideoId(contextUrl);
const commentResponse = http.GET(`${URL_COMMENTS}${video_id}&page=${page}`, headerDict);
if(!commentResponse.isOk)
throw new ScriptException(`Failed to get comments for ${video_id} (page ${page}) [${commentResponse.code}]`)
const results = JSON.parse(commentResponse.body);

const comments = results.data?.map(i => {
const c = new Comment({
contextUrl: contextUrl,
author: new PlatformAuthorLink(getPlatformId(i.id),
i.user.name ?? "",
URL_PROFILE + i.user.url_slug,
i.user.avatar.variations[0]?.url ?? ""),
message: i.text ?? "",
date: parseDate(i.created_at),
replyCount: i.count_replies,
context: { commentId: i.id }
});

return c;
}) ?? [];

const hasMore = results.meta.current_page < result.result.last_page;
return new PietsmietDECommentPager(comments, hasMore, contextUrl);

}

class PietsmietDECommentPager extends CommentPager {
constructor(comments, hasMore, contextUrl) {
super(comments, hasMore != null, contextUrl);
this.hasMore = hasMore;
}
nextPage() {
if(!this.hasMore)
return new CommentPager([], false);
this.page++;
return getCommentResults(this.contextUrl, this.page) ?? new CommentPager([], false);
}
}


//Comments
source.getComments = function (url) {
// const video_id = parseVideoId(url);
return getCommentResults(id, url, 1, true);


return new CommentPager([], false); // getCommentResults(id, url, 1, true);
};
source.getSubComments = function (comment) {
throw new ScriptException("This is a sample");
};
// class PietsmietDECommentPager extends CommentPager {
// constructor(comments, hasMore, contextUrl) {
// super(comments, hasMore != null, contextUrl);
// this.hasMore = hasMore;
// }
// nextPage() {
// if(!this.hasMore)
// return new CommentPager([], false);
// this.page++;
// return getCommentResults(this.contextUrl, this.page) ?? new CommentPager([], false);
// }
// }

// function getCommentResults(contextUrl, page) {
// const video_id = parseVideoId(contextUrl);
// const commentResponse = http.GET(`${URL_COMMENTS}${video_id}&page=${page}`, headerDict);
// if(!commentResponse.isOk)
// throw new ScriptException(`Failed to get comments for ${video_id} (page ${page}) [${commentResponse.code}]`)
// const results = JSON.parse(commentResponse.body);

// const comments = results.data?.map(i => {
// const c = new Comment({
// contextUrl: contextUrl,
// author: new PlatformAuthorLink(getPlatformId(i.id),
// i.user.name ?? "",
// URL_PROFILE + i.user.url_slug,
// i.user.avatar.variations[0]?.url ?? ""),
// message: i.text ?? "",
// date: parseDate(i.created_at),
// replyCount: i.count_replies,
// context: { commentId: i.id }
// });

// return c;
// }) ?? [];

// const hasMore = results.meta.current_page < result.result.last_page;
// return new PietsmietDECommentPager(comments, hasMore, contextUrl);
// }

log("LOADED");

0 comments on commit a4e4bfa

Please sign in to comment.