Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Made readme consistent with actual return values and hotfixed missing…
Browse files Browse the repository at this point in the history
… voteCount for 0 liked
  • Loading branch information
GilgusMaximus committed May 22, 2021
1 parent dc34235 commit 2743a9c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The data is returned as a list of objects (seen below). The replies have the sam
],
edited: Boolean, // If the comment has been edited or not
text: String, // The text content of the comment
likes: Number, // The amount of likes the comment has
likes: String, // The amount of likes the comment has, numbers > 1000 displayed with 1.9K, 2K...
time: String, // The time the comment was published. Written as "One day ago"
numReplies: Number, // The number of replies found for the comment
isHearted: Boolean, // If the video channel hearted the comment
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yt-comment-scraper",
"version": "4.0.2",
"version": "4.0.3",
"description": "Scrapes the comments of any YouTube video without YouTube API access. Uses the default YouTube Ajax calls to get the comment data.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/htmlParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HtmlParser {
const authorId = comment.authorEndpoint.browseEndpoint.browseId
const authorName = comment.authorText.simpleText
const authorThumbnails = comment.authorThumbnail.thumbnails
const likes = this.parseShortedNumberString(comment.voteCount.simpleText.split(' ')[0])
const likes = ('voteCount' in comment) ? comment.voteCount.simpleText.split(' ')[0] : '0'
const numReplies = comment.replyCount ? comment.replyCount : 0
const publishedTimeText = comment.publishedTimeText.runs[0].text
const publishedText = publishedTimeText.replace('(edited)', '').trim()
Expand Down

0 comments on commit 2743a9c

Please sign in to comment.