Skip to content

Commit

Permalink
Merge pull request #70 from hello-world-1989/main
Browse files Browse the repository at this point in the history
Update proxy.js
  • Loading branch information
hello-world-1989 authored Dec 2, 2024
2 parents ed7a15f + f2f8e30 commit 1b58aeb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ app.use('/tweet-page-7', async (req, res) => {
const tweets = result
?.sort((a, b) => (a.createdDate > b.createdDate ? -1 : 1))
.map((item) => {
const images = item?.images?.split(',');
const images = item?.images?.split(',') ?? [];

if (item.videos) {
const videoImages = item.videos?.split(',');
if (item?.videos) {
const videoImages = item?.videos?.split(',');
images.push(...videoImages);
}

const nonEmpty = images.filter((item) => item);

item.allImages = nonEmpty;
item.allImages = nonEmpty ?? [];

return item;
});
Expand Down Expand Up @@ -137,16 +137,16 @@ app.get('/tweet-page', async (req, res) => {
const tweets = response?.data
?.sort((a, b) => (a.createdDate > b.createdDate ? -1 : 1))
.map((item) => {
const images = item?.images?.split(',');
const images = item?.images?.split(',') ?? [];

if (item.videos) {
if (item?.videos) {
const videoImages = item.videos?.split(',');
images.push(...videoImages);
}

const nonEmpty = images.filter((item) => item);
const nonEmpty = images?.filter((item) => item);

item.allImages = nonEmpty;
item.allImages = nonEmpty ?? [];

return item;
});
Expand Down

0 comments on commit 1b58aeb

Please sign in to comment.