Compare commits

...

2 Commits

Author SHA1 Message Date
Drake 385ed10117 add more things to search i guess idk anymore
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
1 year ago
Drake 285b2e69bf get rid of old tests + make lint issues disappear
1 year ago

@ -1,19 +0,0 @@
import AO3 from "./src/classes/AO3.ts";
const ao3 = new AO3();
await ao3.authenticate(
Deno.env.get("AO3USERNAME") as string,
Deno.env.get("AO3PASSWORD") as string,
);
const res = await ao3.search({
fandoms: ["Murder Drones (Web Series)"],
limit: 10,
});
await res.update(1);
res.results.forEach(
(v) => console.log(v.name),
);

@ -1,12 +0,0 @@
import AO3 from "./src/classes/AO3.ts";
const ao3 = new AO3();
const res = await ao3.search({
freeform: ["no beta read we die like sammy"],
limit: 1,
});
await res.update(1);
console.log(await res.results[0].chapters[0].text);

@ -15,13 +15,13 @@ export default class AO3 {
get: (path: string) => Promise<Response>;
post: (
path: string,
payload: Record<string, any>,
payload: unknown,
) => Promise<Response>;
};
DOMParser = new DOMParser();
fetch: typeof fetch;
cookieJar: CookieJar;
#headers: Record<string, any>;
#headers: Record<string, string>;
/**
* a representation of AO3 in class form

@ -30,10 +30,13 @@ export interface SearchParameters {
any?: string;
title?: string;
author?: string;
complete?: boolean;
single_chapter?: boolean;
word_count?: number;
language?: string;
fandoms?: string[];
characters?: string[];
relationships?: string[];
freeform?: string[];
ratings?: number[];
warnings?: number[];
@ -56,12 +59,25 @@ export default class Search {
&work_search[query]=${this.#opts.any ?? ""}
&work_search[title]=${this.#opts.title ?? ""}
&work_search[creators]=${this.#opts.author ?? ""}
&work_search[complete]=${this.#opts.complete ?? ""}
&${
this.#opts.freeform?.map((v) => `work_search[freeform_names]=${v}`)
this.#opts.fandoms?.map((v) => `work_search[fandom_names]=${v}`)
.join("&")
}
&${
this.#opts.fandoms?.map((v) => `work_search[fandom_names]=${v}`)
this.#opts.characters?.map((v) =>
`work_search[character_names]=${v}`
)
.join("&")
}
&${
this.#opts.relationships?.map((v) =>
`work_search[relationship_names]=${v}`
)
.join("&")
}
&${
this.#opts.freeform?.map((v) => `work_search[freeform_names]=${v}`)
.join("&")
}`;

@ -1,17 +0,0 @@
import AO3 from "./src/classes/AO3.ts";
import { assert } from "https://deno.land/std@0.161.0/testing/asserts.ts";
const ao3 = new AO3();
/* const res = await ao3.search({
any: "hazbin hotel",
limit: 1,
});
await res.update(1);
console.log(await res.results[0].chapters[0].text); */
let work = await ao3.getWork("43724875");
await work.init();
Loading…
Cancel
Save