Catch the community id and the custom url of the author

This commit is contained in:
Jarzon 2017-01-31 08:48:38 -05:00
parent f1b742dff4
commit db3aa4ace8

View File

@ -534,10 +534,7 @@ SteamCommunity.prototype.getAllGroupComments = function(gid, from, count, callba
var comments = [];
body = JSON.parse(body);
body = body.comments_html;
$ = Cheerio.load(body);
$ = Cheerio.load(JSON.parse(body).comments_html);
$(".commentthread_comment_content").each(function () {
var comment = {};
@ -545,11 +542,10 @@ SteamCommunity.prototype.getAllGroupComments = function(gid, from, count, callba
cachedSelector = $(this).find(".commentthread_author_link");
comment.authorName = $(cachedSelector).find("bdi").text();
comment.authorId = $(cachedSelector).attr('href').replace("http://steamcommunity.com/id/", "");
comment.authorId = $(cachedSelector).attr('href').replace(/http:\/\/steamcommunity.com\/(id|profiles)\//, "");
comment.date = chrono.parseDate($(this).find(".commentthread_comment_timestamp").text().trim());
cachedSelector = $(this).find(".commentthread_comment_text");
comment.commentId = $(cachedSelector).attr('id').replace("comment_content_", "");
comment.text = $(cachedSelector).text().trim();