Skip to content

Commit

Permalink
Added YouTube video auto fetching, PostCommentOnFriendsScreenshot que…
Browse files Browse the repository at this point in the history
…st moved to non-limited accounts.

- added noinspection for default options
  • Loading branch information
HenkerX64 committed Feb 25, 2022
1 parent 3b99de9 commit a903148
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 8 additions & 4 deletions classes/CCommunityLeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ function CCommunityLeader(communityBadge, options) {
friendQuests.push('PostCommentOnFriendsPage');
}
await execute(friendQuests.concat([
'PostCommentOnFriendsScreenshot',
'RateUpContentInActivityFeed',
'UseEmoticonInChat',
]));
Expand All @@ -220,6 +219,7 @@ function CCommunityLeader(communityBadge, options) {
]);
if (!this.isLimitedAccount) {
await execute([
'PostCommentOnFriendsScreenshot',
'RecommendGame',
]);
}
Expand Down Expand Up @@ -405,10 +405,14 @@ CCommunityLeader.prototype.PostVideo = function () {
return new Promise(async (resolve) => {
this._badgeUnlocker.setYoutubeCookies(this.options.youtubeCookies);
if (!this.options.youtubeId) {
resolve(false);
return;
const videos = await this._badgeUnlocker.fetchYoutubeVideos().catch(() => []);
if (videos.length === 0) {
resolve(false);
return;
}
this.options.youtubeId = videos[0].youtubeId;
}
const postedVideos = await this._badgeUnlocker.postYoutubeVideo(this.options.youtubeId);
const postedVideos = await this._badgeUnlocker.postYoutubeVideo(this.options.youtubeId).catch(() => 0);
if (postedVideos > 0) {
const videos = await this._badgeUnlocker.getProfileVideos().catch(() => []);
for (let video of videos) {
Expand Down
6 changes: 4 additions & 2 deletions resources/OCommunityLeaderDefault.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// noinspection JSValidateJSDoc

/** @class OCommunityLeaderDefault */
module.exports = {
/** @type {string} */
Expand Down Expand Up @@ -34,11 +36,11 @@ module.exports = {
/** @type {string} */
screenshotPath: __dirname + '/empty.png',

/** @type {string} */
/** @type {string|null} (optional) */
youtubeId: null,
/** @type {YoutubeCookies} */
youtubeCookies: {
accessToken: '',
accessToken: null,
authAccount: '',
refreshToken: 'null',
},
Expand Down

0 comments on commit a903148

Please sign in to comment.