Find correct body of the post

pull/73/head
MillenniumEarl 2021-03-02 19:09:36 +01:00
parent 0d28d98d13
commit 5337012a32
1 changed files with 4 additions and 4 deletions

View File

@ -90,7 +90,7 @@ export default class Post {
}); });
// Finally parse the post // Finally parse the post
this.parsePost($(post)); this.parsePost($, $(post));
} else throw htmlResponse.value; } else throw htmlResponse.value;
} }
@ -98,7 +98,7 @@ export default class Post {
//#region Private methods //#region Private methods
private parsePost(post: cheerio.Cheerio): void { private parsePost($: cheerio.Root, post: cheerio.Cheerio): void {
// Find post's ID // Find post's ID
const sid: string = post.find(POST.ID).attr("id").replace("post-", ""); const sid: string = post.find(POST.ID).attr("id").replace("post-", "");
this._id = parseInt(sid); this._id = parseInt(sid);
@ -125,8 +125,8 @@ export default class Post {
this._message = post.find(POST.BODY).text(); this._message = post.find(POST.BODY).text();
// Parse post's body // Parse post's body
const $ = cheerio.load(post.html()); const body = post.find(POST.BODY);
this._body = parseF95ThreadPost($, post); this._body = parseF95ThreadPost($, body);
} }
//#endregion //#endregion