Open Ankitkumar7 opened 4 years ago
I also am getting this issue
Hotfix:
Replace these lines (173-179):
var dislikeCount = $(
'.like-button-renderer-dislike-button-unclicked span'
).text()
dislikeCount = dislikeCount ? parseVotes(dislikeCount) : undefined
var likeCount = $('.like-button-renderer-like-button-unclicked span').text()
likeCount = likeCount ? parseVotes(likeCount) : undefined
With these lines:
var getYtInitialData = $('script:contains("window["ytInitialData"]")').text().replace(/(\r\n|\n|\r)/gm, "")
var parsedYtInitialData = getYtInitialData.split('window["ytInitialData"] = ').pop().split('window["ytInitialPlayerResponse"] = ')[0]
parsedYtInitialData = JSON.parse(parsedYtInitialData.trim().slice(0, -1))
var dislikeCount = parsedYtInitialData.contents.twoColumnWatchNextResults.results.results.contents[0].videoPrimaryInfoRenderer.videoActions.menuRenderer.topLevelButtons[1].toggleButtonRenderer.defaultText.simpleText
var likeCount = parsedYtInitialData.contents.twoColumnWatchNextResults.results.results.contents[0].videoPrimaryInfoRenderer.videoActions.menuRenderer.topLevelButtons[0].toggleButtonRenderer.defaultText.simpleText
In index.js file. Not the most beautiful code, but at least it works :D
Result:
{ videoId: 'liJVSwOiiwg', url: 'https://www.youtube.com/watch?v=liJVSwOiiwg', title: 'How To Find YouTube Video ID 2020', description: null, owner: 'WebbyFan.com', channelId: 'UC8w4I8t2OpqoOpzzNT1c2dg', thumbnailUrl: 'https://i.ytimg.com/vi/liJVSwOiiwg/maxresdefault.jpg', embedURL: undefined, datePublished: '2017-07-04', genre: 'Howto & Style', paid: false, unlisted: false, isFamilyFriendly: true, duration: 155, views: 86514, regionsAllowed: [ '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 ], dislikeCount: '92', likeCount: '672', channelThumbnailUrl: undefined }
Hotfix:
Replace these lines (173-179):
var dislikeCount = $( '.like-button-renderer-dislike-button-unclicked span' ).text() dislikeCount = dislikeCount ? parseVotes(dislikeCount) : undefined var likeCount = $('.like-button-renderer-like-button-unclicked span').text() likeCount = likeCount ? parseVotes(likeCount) : undefined
With these lines:
var getYtInitialData = $('script:contains("window["ytInitialData"]")').text().replace(/(\r\n|\n|\r)/gm, "") var parsedYtInitialData = getYtInitialData.split('window["ytInitialData"] = ').pop().split('window["ytInitialPlayerResponse"] = ')[0] parsedYtInitialData = JSON.parse(parsedYtInitialData.trim().slice(0, -1)) var dislikeCount = parsedYtInitialData.contents.twoColumnWatchNextResults.results.results.contents[0].videoPrimaryInfoRenderer.videoActions.menuRenderer.topLevelButtons[1].toggleButtonRenderer.defaultText.simpleText var likeCount = parsedYtInitialData.contents.twoColumnWatchNextResults.results.results.contents[0].videoPrimaryInfoRenderer.videoActions.menuRenderer.topLevelButtons[0].toggleButtonRenderer.defaultText.simpleText
In index.js file. Not the most beautiful code, but at least it works :D
Result:
{ videoId: 'liJVSwOiiwg', url: 'https://www.youtube.com/watch?v=liJVSwOiiwg', title: 'How To Find YouTube Video ID 2020', description: null, owner: 'WebbyFan.com', channelId: 'UC8w4I8t2OpqoOpzzNT1c2dg', thumbnailUrl: 'https://i.ytimg.com/vi/liJVSwOiiwg/maxresdefault.jpg', embedURL: undefined, datePublished: '2017-07-04', genre: 'Howto & Style', paid: false, unlisted: false, isFamilyFriendly: true, duration: 155, views: 86514, regionsAllowed: [ '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 ], dislikeCount: '92', likeCount: '672', channelThumbnailUrl: undefined }
Wow thanks so much! I don't know how to get the like and dislike data so didn't know what to do lol
code: fetchVideoInfo("liJVSwOiiwg").then(function (videoInfo) { console.log(videoInfo); });
output:
{ videoId: 'liJVSwOiiwg', url: 'https://www.youtube.com/watch?v=liJVSwOiiwg', title: 'How To Find YouTube Video ID 2020', description: 'Computer / Mobile Device : How To Find YouTube Video ID for Any Video.Number 2020 Share This Video : https://www.youtube.com/watch?v=liJVSwOiiwg Steps To Get...', owner: 'WebbyFan.com', channelId: 'UC8w4I8t2OpqoOpzzNT1c2dg', thumbnailUrl: 'https://i.ytimg.com/vi/liJVSwOiiwg/maxresdefault.jpg', embedURL: undefined, datePublished: '2017-07-04', genre: 'Howto & Style', paid: false, unlisted: false, isFamilyFriendly: true, duration: 155, views: 84116, regionsAllowed: [ '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 ], dislikeCount: undefined, likeCount: 0, channelThumbnailUrl: undefined }