Add missin radic parameter

pull/75/head
MillenniumEarl 2021-03-04 10:55:00 +01:00
parent 036e42f31f
commit f9f852c003
4 changed files with 11 additions and 11 deletions

View File

@ -84,7 +84,7 @@ export default class Post {
const post = $(THREAD.POSTS_IN_PAGE).toArray().find((el, idx) => {
// Fetch the ID and check if it is what we are searching
const sid: string = $(el).find(POST.ID).attr("id").replace("post-", "");
const id = parseInt(sid);
const id = parseInt(sid, 10);
if (id === this.id) return el;
});
@ -101,11 +101,11 @@ export default class Post {
private async parsePost($: cheerio.Root, post: cheerio.Cheerio): Promise<void> {
// Find post's ID
const sid: string = post.find(POST.ID).attr("id").replace("post-", "");
this._id = parseInt(sid);
this._id = parseInt(sid, 10);
// Find post's number
const sNumber: string = post.find(POST.NUMBER).text().replace("#", "");
this._number = parseInt(sNumber);
this._number = parseInt(sNumber, 10);
// Find post's publishing date
const sPublishing: string = post.find(POST.PUBLISH_DATE).attr("datetime");
@ -117,7 +117,7 @@ export default class Post {
// Find post's owner
const sOwnerID: string = post.find(POST.OWNER_ID).attr("data-user-id").trim();
this._owner = new PlatformUser(parseInt(sOwnerID));
this._owner = new PlatformUser(parseInt(sOwnerID, 10));
await this._owner.fetch();
// Find if the post is bookmarked

View File

@ -125,7 +125,7 @@ export default class Thread {
.toArray()
.map((el, idx) => {
const id = $(el).find(POST.ID).attr("id").replace("post-", "");
return new Post(parseInt(id));
return new Post(parseInt(id, 10));
});
// Wait for the post to be fetched
@ -174,8 +174,8 @@ export default class Thread {
const ratingTree = data["aggregateRating"] as TJsonLD;
const rating: TRating = {
average: ratingTree ? parseFloat(ratingTree["ratingValue"] as string) : 0,
best: ratingTree ? parseInt(ratingTree["bestRating"] as string) : 0,
count: ratingTree ? parseInt(ratingTree["ratingCount"] as string) : 0,
best: ratingTree ? parseInt(ratingTree["bestRating"] as string, 10) : 0,
count: ratingTree ? parseInt(ratingTree["ratingCount"] as string, 10) : 0,
};
return rating;
@ -227,7 +227,7 @@ export default class Thread {
this._title = this.cleanHeadline(JSONLD["headline"] as string);
this._tags = tagArray.map(el => $(el).text().trim());
this._prefixes = prefixArray.map(el => $(el).text().trim());
this._owner = new PlatformUser(parseInt(ownerID));
this._owner = new PlatformUser(parseInt(ownerID, 10));
await this._owner.fetch();
this._rating = this.parseRating(JSONLD);
this._category = JSONLD["articleSection"] as TCategory;

View File

@ -100,7 +100,7 @@ export default class UserProfile extends PlatformUser {
const $ = cheerio.load(htmlResponse.value);
const sid = $(GENERIC.CURRENT_USER_ID).attr("data-user-id").trim();
return parseInt(sid);
return parseInt(sid, 10);
} else throw htmlResponse.value;
}
@ -116,7 +116,7 @@ export default class UserProfile extends PlatformUser {
const $ = cheerio.load(htmlResponse.value);
// Fetch the pages
const lastPage = parseInt($(WATCHED_THREAD.LAST_PAGE).text().trim());
const lastPage = parseInt($(WATCHED_THREAD.LAST_PAGE).text().trim(), 10);
const pages = await this.fetchPages(url, lastPage);
const watchedThreads = pages.map((r, idx) => {

View File

@ -82,7 +82,7 @@ export default class PrefixParser {
if (dict) {
// Extract the key from the dict
const key = this.getKeyByValue(dict, p);
ids.push(parseInt(key));
ids.push(parseInt(key), 10);
}
}
return ids;