fix(ts): add strict file & type imports

This commit is contained in:
Ritesh Ghosh
2023-11-22 13:56:16 +05:30
parent 5d2b27270c
commit 03b3550b49
10 changed files with 56 additions and 64 deletions
+6 -7
View File
@@ -1,16 +1,15 @@
import axios, { AxiosError } from "axios";
import { load, CheerioAPI, SelectorType } from "cheerio";
import {
SRC_BASE_URL,
extractAnimes,
ACCEPT_HEADER,
USER_AGENT_HEADER,
ACCEPT_ENCODING_HEADER,
extractMostPopularAnimes,
extractAnimes,
} from "../utils";
import createHttpError, { HttpError } from "http-errors";
import { ScrapedAnimeAboutInfo } from "../models/parsers";
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import createHttpError, { type HttpError } from "http-errors";
import { load, type CheerioAPI, type SelectorType } from "cheerio";
import { type ScrapedAnimeAboutInfo } from "../models/parsers/index.js";
// /anime/info?id=${anime-id}
async function scrapeAnimeAboutInfo(
+8 -9
View File
@@ -1,17 +1,16 @@
import axios, { AxiosError } from "axios";
import { load, CheerioAPI, SelectorType } from "cheerio";
import {
SRC_BASE_URL,
extractAnimes,
ACCEPT_HEADER,
USER_AGENT_HEADER,
ACCEPT_ENCODING_HEADER,
extractAnimes,
extractTop10Animes,
} from "../utils";
import { AnimeCategories } from "../models/anime";
import createHttpError, { HttpError } from "http-errors";
import { ScrapedAnimeCategory } from "../models/parsers";
ACCEPT_ENCODING_HEADER,
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import { type AnimeCategories } from "../models/anime.js";
import createHttpError, { type HttpError } from "http-errors";
import { load, type CheerioAPI, type SelectorType } from "cheerio";
import { type ScrapedAnimeCategory } from "../models/parsers/index.js";
// /anime/:category?page=${page}
async function scrapeAnimeCategory(
+8 -9
View File
@@ -1,16 +1,15 @@
import {
SRC_BASE_URL,
SRC_AJAX_URL,
USER_AGENT_HEADER,
SRC_BASE_URL,
retrieveServerId,
} from "../utils";
USER_AGENT_HEADER,
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import { load, CheerioAPI } from "cheerio";
import { AnimeServers, Servers } from "../models/anime";
import createHttpError, { HttpError } from "http-errors";
import { ScrapedAnimeEpisodesSources } from "../models/parsers";
import { RapidCloud, StreamSB, StreamTape } from "../extractors";
import { load, type CheerioAPI } from "cheerio";
import createHttpError, { type HttpError } from "http-errors";
import { type AnimeServers, Servers } from "../models/anime.js";
import { RapidCloud, StreamSB, StreamTape } from "../extractors/index.js";
import { type ScrapedAnimeEpisodesSources } from "../models/parsers/index.js";
// vidtreaming -> 4
// rapidcloud -> 1
+4 -4
View File
@@ -4,11 +4,11 @@ import {
ACCEPT_HEADER,
USER_AGENT_HEADER,
ACCEPT_ENCODING_HEADER,
} from "../utils";
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import createHttpError, { HttpError } from "http-errors";
import { load, CheerioAPI } from "cheerio";
import { ScrapedAnimeEpisodes } from "../models/parsers";
import { load, type CheerioAPI } from "cheerio";
import createHttpError, { type HttpError } from "http-errors";
import { type ScrapedAnimeEpisodes } from "../models/parsers/index.js";
// /anime/episodes/${anime-id}
async function scrapeAnimeEpisodes(
+6 -7
View File
@@ -1,16 +1,15 @@
import axios, { AxiosError } from "axios";
import createHttpError, { HttpError } from "http-errors";
import { load, CheerioAPI, SelectorType } from "cheerio";
import {
SRC_BASE_URL,
ACCEPT_HEADER,
extractAnimes,
USER_AGENT_HEADER,
ACCEPT_ENCODING_HEADER,
extractMostPopularAnimes,
extractAnimes,
} from "../utils";
import { ScrapedGenreAnime } from "../models/parsers";
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import createHttpError, { type HttpError } from "http-errors";
import { load, type CheerioAPI, type SelectorType } from "cheerio";
import type { ScrapedGenreAnime } from "../models/parsers/index.js";
// /anime/genre/${name}?page=${page}
async function scrapeGenreAnime(
+5 -6
View File
@@ -1,7 +1,3 @@
import axios, { AxiosError } from "axios";
import createHttpError, { HttpError } from "http-errors";
import { load, CheerioAPI, SelectorType } from "cheerio";
import {
SRC_BASE_URL,
ACCEPT_HEADER,
@@ -10,8 +6,11 @@ import {
extractMostPopularAnimes,
extractAnimes,
extractTop10Animes,
} from "../utils";
import { ScrapedProducerAnime } from "../models/parsers";
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import createHttpError, { type HttpError } from "http-errors";
import { load, type CheerioAPI, type SelectorType } from "cheerio";
import type { ScrapedProducerAnime } from "../models/parsers/index.js";
// /anime/producer/${name}?page=${page}
async function scrapeProducerAnimes(
+5 -6
View File
@@ -1,5 +1,3 @@
import axios, { AxiosError } from "axios";
import { load, CheerioAPI, SelectorType } from "cheerio";
import {
SRC_SEARCH_URL,
ACCEPT_HEADER,
@@ -7,10 +5,11 @@ import {
ACCEPT_ENCODING_HEADER,
extractMostPopularAnimes,
extractAnimes,
} from "../utils";
import createHttpError, { HttpError } from "http-errors";
import { ScrapedAnimeSearchResult } from "../models/parsers";
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import createHttpError, { type HttpError } from "http-errors";
import { load, type CheerioAPI, type SelectorType } from "cheerio";
import type { ScrapedAnimeSearchResult } from "../models/parsers/index.js";
// /anime/search?q=${query}&page=${page}
async function scrapeAnimeSearch(
+5 -6
View File
@@ -1,14 +1,13 @@
import axios, { AxiosError } from "axios";
import { load, CheerioAPI, SelectorType } from "cheerio";
import {
SRC_HOME_URL,
SRC_AJAX_URL,
USER_AGENT_HEADER,
ACCEPT_ENCODING_HEADER,
} from "../utils";
import createHttpError, { HttpError } from "http-errors";
import { ScrapedAnimeSearchSuggestion } from "../models/parsers";
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import createHttpError, { type HttpError } from "http-errors";
import { load, type CheerioAPI, type SelectorType } from "cheerio";
import type { ScrapedAnimeSearchSuggestion } from "../models/parsers/index.js";
// /anime/search/suggest?q=${query}
async function scrapeAnimeSearchSuggestion(
+4 -4
View File
@@ -4,11 +4,11 @@ import {
ACCEPT_HEADER,
USER_AGENT_HEADER,
ACCEPT_ENCODING_HEADER,
} from "../utils";
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import createHttpError, { HttpError } from "http-errors";
import { load, CheerioAPI, SelectorType } from "cheerio";
import { ScrapedEpisodeServers } from "../models/parsers";
import createHttpError, { type HttpError } from "http-errors";
import { load, type CheerioAPI, type SelectorType } from "cheerio";
import type { ScrapedEpisodeServers } from "../models/parsers/index.js";
// /anime/servers?episodeId=${id}
async function scrapeEpisodeServers(
+5 -6
View File
@@ -1,5 +1,3 @@
import axios, { AxiosError } from "axios";
import { load, CheerioAPI, SelectorType } from "cheerio";
import {
SRC_HOME_URL,
ACCEPT_HEADER,
@@ -7,10 +5,11 @@ import {
ACCEPT_ENCODING_HEADER,
extractTop10Animes,
extractAnimes,
} from "../utils";
import createHttpError, { HttpError } from "http-errors";
import { ScrapedHomePage } from "../models/parsers";
} from "../utils/index.js";
import axios, { AxiosError } from "axios";
import createHttpError, { type HttpError } from "http-errors";
import type { ScrapedHomePage } from "../models/parsers/index.js";
import { load, type CheerioAPI, type SelectorType } from "cheerio";
// /anime/home
async function scrapeHomePage(): Promise<ScrapedHomePage | HttpError> {