Skip to content

Commit 155aa43

Browse files
committed
Fix naming and handling of Anonymous
1 parent f988712 commit 155aa43

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/series/getters.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@ export const getSeriesTitle = ($seriesPage: SeriesPage): string => {
3131
return $seriesPage("h2.heading").text().trim();
3232
};
3333

34-
export const getSeriesAuthors = (
34+
export const getSeriesCreators = (
3535
$seriesPage: SeriesPage
36-
): Series["authors"] => {
37-
const authorLinks = $seriesPage("dl.series a[rel=author]");
38-
const authors: Author[] = [];
36+
): Series["creators"] => {
37+
const creatorLinks = $seriesPage("dl.meta a[rel=author]");
38+
const creators: Author[] = [];
3939

4040
if (
41-
$seriesPage("dl.series dd:nth-of-type(1)").text().trim() === "Anonymous"
41+
$seriesPage("dl.meta > dd:nth-of-type(1)").text().trim() === "Anonymous"
4242
) {
4343
return "Anonymous";
4444
}
4545

46-
if (authorLinks.length !== 0) {
47-
authorLinks.each((i, element) => {
46+
if (creatorLinks.length !== 0) {
47+
creatorLinks.each((i, element) => {
4848
const url = element.attribs.href;
4949
const [, username, pseud] = url.match(/users\/(.+)\/pseuds\/(.+)/)!;
5050

51-
authors.push({ username: username, pseud: decodeURI(pseud) });
51+
creators.push({ username: username, pseud: decodeURI(pseud) });
5252
});
5353
}
5454

55-
return authors;
55+
return creators;
5656
};
5757

5858
export const getSeriesDescription = (

src/series/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { loadSeriesPage } from "src/page-loaders";
22
import { Series } from "types/entities";
33
import {
4-
getSeriesAuthors,
4+
getSeriesCreators,
55
getSeriesBookmarkCount,
66
getSeriesCompletionStatus,
77
getSeriesDescription,
@@ -29,7 +29,7 @@ export const getSeries = async ({
2929
name: getSeriesTitle(seriesPage),
3030
begunAt: getSeriesPublishDate(seriesPage),
3131
updatedAt: getSeriesUpdateDate(seriesPage),
32-
creators: getSeriesAuthors(seriesPage),
32+
creators: getSeriesCreators(seriesPage),
3333
description: getSeriesDescription(seriesPage),
3434
notes: getSeriesNotes(seriesPage),
3535
words: getSeriesWordCount(seriesPage),

0 commit comments

Comments
 (0)