Skip to content

Commit

Permalink
Fix #334: *Communities* tab is now displayed as *Posts*
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-Loison committed Feb 8, 2025
1 parent 0e6889e commit d1b79ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion channels.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function getItem($id, $order, $continuationToken)
$community = [];
$contents = null;
if (!$continuationTokenProvided) {
$tab = getTabByName($result, 'Community');
$tab = getTabByName($result, 'Posts');
$contents = $tab['tabRenderer']['content']['sectionListRenderer']['contents'][0]['itemSectionRenderer']['contents'];
} else {
$contents = $result['onResponseReceivedEndpoints'][0]['appendContinuationItemsAction']['continuationItems'];
Expand Down
4 changes: 2 additions & 2 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function getCommunityPostFromContent($content)
$common = getValue($backstagePost, 'backstagePostRenderer', 'sharedPostRenderer');

$id = $common['postId'];
$channelId = $common['publishedTimeText']['runs'][0]['navigationEndpoint']['browseEndpoint']['browseId'];
$channelId = $common['authorEndpoint']['browseEndpoint']['browseId'];

// Except for `Image`, all other posts require text.
$contentText = [];
Expand Down Expand Up @@ -401,7 +401,7 @@ function getCommunityPostFromContent($content)
'channelId' => $channelId,
'channelName' => $common['authorText']['runs'][0]['text'],
'channelHandle' => substr($common['authorEndpoint']['browseEndpoint']['canonicalBaseUrl'], 1),
'channelThumbnails' => $common['authorThumbnail']['thumbnails'],
'channelThumbnails' => array_map(function($thumbnail) { $thumbnail['url'] = 'https:' . $thumbnail['url']; return $thumbnail; }, $common['authorThumbnail']['thumbnails']),
'date' => $date,
'contentText' => $contentText,
'likes' => $likes,
Expand Down

0 comments on commit d1b79ac

Please sign in to comment.