Comicvine improvements #2

Merged
rishighan merged 6 commits from comicvine-improvements into master 2025-02-20 17:38:56 +00:00
Showing only changes of commit 30743a11cf - Show all commits

View File

@@ -2,7 +2,6 @@
import { Service, ServiceBroker, Context } from "moleculer"; import { Service, ServiceBroker, Context } from "moleculer";
import axios from "axios"; import axios from "axios";
import delay from "delay";
import { isNil, isUndefined } from "lodash"; import { isNil, isUndefined } from "lodash";
import { fetchReleases, FilterTypes, SortTypes } from "comicgeeks"; import { fetchReleases, FilterTypes, SortTypes } from "comicgeeks";
import { matchScorer, rankVolumes } from "../utils/searchmatchscorer.utils"; import { matchScorer, rankVolumes } from "../utils/searchmatchscorer.utils";
@@ -496,19 +495,20 @@ export default class ComicVineService extends Service {
async handler(ctx: Context<{ volumeId: number }>) { async handler(ctx: Context<{ volumeId: number }>) {
const { volumeId } = ctx.params; const { volumeId } = ctx.params;
const issuesUrl = `${CV_BASE_URL}issues/?api_key=${process.env.COMICVINE_API_KEY}&filter=volume:${volumeId}&format=json&field_list=id,name,issue_number,description,image`; const issuesUrl = `${CV_BASE_URL}issues/?api_key=${process.env.COMICVINE_API_KEY}`;
try { try {
const response = await axios({ const response = await axios.get(issuesUrl, {
url: issuesUrl,
method: "GET",
params: { params: {
limit: "100", api_key: process.env.COMICVINE_API_KEY,
filter: `volume:${volumeId}`,
format: "json", format: "json",
field_list:
"id,name,image,issue_number,cover_date,description",
limit: 100, // Adjust the limit as per your requirement
}, },
headers: { headers: {
Accept: "application/json", Accept: "application/json",
"User-Agent": "ThreeTwo", "User-Agent": "ThreeTwo", // It's good practice to define a User-Agent, especially when using APIs that might track request sources
}, },
}); });