fent/node-ytdl-core

Do you want to work on this issue?

You can request for a bounty in order to promote it!

like and dislike null value even the video has a like and dislike value #1268

solcabz posted onGitHub

image

title: 'PANGARAP NA HOUSE TOUR', description: '#SERGEYBIN #PANGARAPNAHOUSETOUR\n' + '\n' + 'Official links for the shirts (SERGE Apparel): โฌ‡โฌ‡โฌ‡\n' + '"Tiktok Shop"\n' + 'The Professor (Ser Geybin) - https://vt.tiktok.com/ZSNJxcVr4/\n' + 'The Shipwright (Chief Allen) - https://vt.tiktok.com/ZSNJxE11b/\n' + 'The Admiral (Capt. Kelzy & Kalo) - https://vt.tiktok.com/ZSNJxwEMV/\n' + ' \n' + '"Shopee Shop"\n' + 'The Professor (Ser Geybin) - https://shopee.ph/The-Professor-(Ser-Geybin)-i.82154395.21759615316?xptdk=4197471d-cb94-4571-a788-1f94eef1abdd\n' + 'The Shipwright (Chief Allen) - https://shopee.ph/The-Shipwright-(Chief-Allen)-i.82154395.19759627152?xptdk=27f7cbb6-f677-4fa6-97a4-033fa2052318\n' + 'The Admiral (Capt. Kelzy & Kalo) - https://shopee.ph/The-Admiral-(Captain-Kelzy-and-Kalo)-i.82154395.14394593761?xptdk=2ca26972-12c6-4f3b-a4c6-9dda73cbcdd4\n' + '\n' + 'แดส แด๊œฐ๊œฐษชแด„ษชแด€สŸ แด€แด„แด„แดแดœษดแด›๊œฑ โฌ‡โฌ‡โฌ‡\n' + '๐…๐š๐œ๐ž๐›๐จ๐จ๐ค ๐๐š๐ ๐ž: https://www.facebook.com/sergeybin\n' + 'โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹๐…๐š๐œ๐ž๐›๐จ๐จ๐ค ๐€๐œ๐œ๐จ๐ฎ๐ง๐ญ: https://www.facebook.com/gavin.capinpin/\n' + '๐ˆ๐ง๐ฌ๐ญ๐š๐ ๐ซ๐š๐ฆ ๐€๐œ๐œ๐จ๐ฎ๐ง๐ญ: https://www.instagram.com/ser.geybin/\n' + '๐“๐ข๐ค๐ญ๐จ๐ค ๐€๐œ๐œ๐จ๐ฎ๐ง๐ญ: https://www.tiktok.com/@ser.geybin' , lengthSeconds: '1962', ownerProfileUrl: 'http://www.youtube.com/@SerGeybin', externalChannelId: 'UCBx0UKTeZ6VS-bNFZ1cCTIA', isFamilySafe: true, availableCountries: [ 'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', ... 149 more items ], isUnlisted: false, hasYpcMetadata: false, viewCount: '907239', category: 'Entertainment', publishDate: '2024-01-07T02:00:29-08:00', ownerChannelName: 'Ser Geybin', uploadDate: '2024-01-07T02:00:29-08:00', videoId: 'XmbSpXI8FZ4', keywords: [ 'Ser Geybin', 'Gavin Capinpin', 'Allen Capinpin', 'Kelzy Capinpin', 'Capinpin Brothers', '#SERGEYBIN', 'SER', 'GEYBIN', 'SER GEYBIN', 'SIR', 'GAVIN', 'SIR GAVIN', 'GAVIN CAPINPIN', '#PANGARAPNAHOUSETOUR', 'PANGARAP NA HOUSE TOUR', 'SER GEYBIN HOUSE TOUR', 'CAMPINPIN', 'SER GEYBIN CAMPINPIN', 'SER GEYBIN BAGOG BAHAY', 'SER GEYBIN NEW HOUSE', 'SER GEYBIN HOUSE', 'CAPINPIN FAMILY HOUSE', 'CAPINPIN FAMILY BAGONG BAHAY', 'HOUSE TOUR NI SER GEYBIN', 'CHIEF ALLEN', 'CAPT KELZY' ], channelId: 'UCBx0UKTeZ6VS-bNFZ1cCTIA', isOwnerViewing: false, isCrawlable: true, allowRatings: true, author: { id: 'UCBx0UKTeZ6VS-bNFZ1cCTIA', name: 'Ser Geybin', user: '@SerGeybin', channel_url: 'https://www.youtube.com/channel/UCBx0UKTeZ6VS-bNFZ1cCTIA', external_channel_url: 'https://www.youtube.com/channel/UCBx0UKTeZ6VS-bNFZ1cCTIA', user_url: 'http://www.youtube.com/@SerGeybin', thumbnails: [Array], verified: true, subscriber_count: 3580000 }, isPrivate: false, isUnpluggedCorpus: false, isLiveContent: false, media: {}, likes: null, dislikes: null, age_restricted: false, video_url: 'https://www.youtube.com/watch?v=XmbSpXI8FZ4', storyboards: [ [Object], [Object], [Object], [Object] ], chapters: [], thumbnails: [ [Object], [Object], [Object], [Object], [Object] ] }, full: true }

like and dislike showing value always null even the video itself have a value


image

const express = require('express');
const ytdl = require('ytdl-core');

const app = express();

app.get('/', async (req, res) => {
  res.sendFile('index.html', { root: './' });
});

app.get('/videoInfo', async (req, res) => {
  const { videoUrl } = req.query;

  if (!videoUrl) {
    return res.status(400).json({ error: 'Please provide a video URL.' });
  }

  try {
    const info = await ytdl.getInfo(videoUrl);
    console.log('Video Info:', info); // Log the entire 'info' object to the console

    const title = info.videoDetails.title;
    const uploadDate = info.videoDetails.uploadDate;
    const views = info.videoDetails.viewCount;
    const duration = parseInt(info.videoDetails.lengthSeconds) / 60;

    // Fetching likes and dislikes with default values of 0
    const likes = info.videoDetails && info.videoDetails.likes ;
    const dislikes = info.videoDetails && info.videoDetails.dislikes ? parseInt(info.videoDetails.dislikes) : 0;

    const separateVideoCounter = info.videoDetails.isLiveContent ? 'Live Stream' : 'Single Video';

    const videoInfo = {
      title,
      uploadDate,
      views,
      duration: duration.toFixed(2),
      likes,
      dislikes, // Adding dislikes to the videoInfo object
      separateVideoCounter,
    };

    res.json(videoInfo);
  } catch (error) {
    res.status(500).json({ error: 'Could not fetch video information.' });
  }
});

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});
posted by solcabz about 1 year ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests