Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
solcabz opened this issue Jan 8, 2024 · 1 comment
Open

Comments

@solcabz
Copy link

solcabz commented Jan 8, 2024

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

@solcabz
Copy link
Author

solcabz commented Jan 8, 2024

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}`);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant