🔧 Debugging the 403 from CV
This commit is contained in:
@@ -191,6 +191,7 @@ export default class ComicVineService extends Service {
|
||||
rawFileDetails: object;
|
||||
}>
|
||||
) => {
|
||||
try {
|
||||
console.log(
|
||||
"Searching against: ",
|
||||
ctx.params.scorerConfiguration.searchParams
|
||||
@@ -211,7 +212,10 @@ export default class ComicVineService extends Service {
|
||||
let volumeIdString = "volume:";
|
||||
potentialVolumeMatches.map(
|
||||
(volumeId: string, idx: number) => {
|
||||
if (idx >= potentialVolumeMatches.length - 1) {
|
||||
if (
|
||||
idx >=
|
||||
potentialVolumeMatches.length - 1
|
||||
) {
|
||||
volumeIdString += `${volumeId}`;
|
||||
return volumeIdString;
|
||||
}
|
||||
@@ -223,7 +227,8 @@ export default class ComicVineService extends Service {
|
||||
let coverDateFilter = "";
|
||||
if (
|
||||
!isNil(
|
||||
ctx.params.scorerConfiguration.searchParams.year
|
||||
ctx.params.scorerConfiguration.searchParams
|
||||
.year
|
||||
)
|
||||
) {
|
||||
const issueYear = parseInt(
|
||||
@@ -239,30 +244,29 @@ export default class ComicVineService extends Service {
|
||||
console.log(filterString);
|
||||
|
||||
const issueMatches = await axios({
|
||||
url: `https://comicvine.gamespot.com/api/issues?api_key=${process.env.COMICVINE_API_KEY}`,
|
||||
method: "GET",
|
||||
url: `${CV_BASE_URL}issues?api_key=${process.env.COMICVINE_API_KEY}`,
|
||||
params: {
|
||||
resources: "issues",
|
||||
limit: "100",
|
||||
format: "json",
|
||||
filter: filterString,
|
||||
},
|
||||
// headers: {
|
||||
// "User-Agent": "ThreeTwo",
|
||||
// "Accept": "application/json",
|
||||
// },
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
});
|
||||
console.log(
|
||||
`Total issues matching the criteria: ${issueMatches.data.results.length}`
|
||||
);
|
||||
// 3. get volume information for the issue matches
|
||||
if (issueMatches.data.results.length === 1) {
|
||||
const volumeInformation = await this.broker.call(
|
||||
const volumeInformation =
|
||||
await this.broker.call(
|
||||
"comicvine.getVolumes",
|
||||
{
|
||||
volumeURI:
|
||||
issueMatches.data.results[0].volume
|
||||
.api_detail_url,
|
||||
issueMatches.data.results[0]
|
||||
.volume.api_detail_url,
|
||||
}
|
||||
);
|
||||
issueMatches.data.results[0].volumeInformation =
|
||||
@@ -271,15 +275,22 @@ export default class ComicVineService extends Service {
|
||||
}
|
||||
const finalMatches = issueMatches.data.results.map(
|
||||
async (issue: any) => {
|
||||
const volumeDetails = await this.broker.call(
|
||||
const volumeDetails =
|
||||
await this.broker.call(
|
||||
"comicvine.getVolumes",
|
||||
{ volumeURI: issue.volume.api_detail_url }
|
||||
{
|
||||
volumeURI:
|
||||
issue.volume.api_detail_url,
|
||||
}
|
||||
);
|
||||
issue.volumeInformation = volumeDetails;
|
||||
return issue;
|
||||
}
|
||||
);
|
||||
return Promise.all(finalMatches);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -287,13 +298,11 @@ export default class ComicVineService extends Service {
|
||||
fetchVolumesFromCV: async (params, output: any[] = []) => {
|
||||
let currentPage = parseInt(params.page, 10);
|
||||
const response = await axios.request({
|
||||
url: `https://comicvine.gamespot.com/api/search?api_key=${process.env.COMICVINE_API_KEY}`,
|
||||
method: "GET",
|
||||
url: `${CV_BASE_URL}search?api_key=${process.env.COMICVINE_API_KEY}`,
|
||||
params,
|
||||
// headers: {
|
||||
// "User-Agent": "ThreeTwo",
|
||||
// "Accept": "application/json",
|
||||
// },
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
const { data } = response;
|
||||
|
||||
Reference in New Issue
Block a user