From ab9f048f875850868e1f0a785ea0d80dcc4bd6f8 Mon Sep 17 00:00:00 2001 From: lamacchinadesiderante Date: Sun, 28 Apr 2024 15:06:24 +0200 Subject: [PATCH] move scraping functions to xvideos folder --- src/app/[locale]/page.tsx | 6 +----- src/app/[locale]/search/[query]/page.tsx | 2 +- src/app/[locale]/video/[id]/page.tsx | 4 ++-- src/utils/scrape/{ => xvideos}/gallery.ts | 2 +- src/utils/scrape/{ => xvideos}/video.ts | 4 ++-- 5 files changed, 7 insertions(+), 11 deletions(-) rename src/utils/scrape/{ => xvideos}/gallery.ts (96%) rename src/utils/scrape/{ => xvideos}/video.ts (96%) diff --git a/src/app/[locale]/page.tsx b/src/app/[locale]/page.tsx index 3ea0f04..53adf1e 100644 --- a/src/app/[locale]/page.tsx +++ b/src/app/[locale]/page.tsx @@ -1,12 +1,8 @@ -import axios from 'axios'; - -import * as cheerio from "cheerio"; - import Layout from "@/components/Layout"; import Home from "@/components/Pages/Home"; -import { fetchGalleryData } from '@/utils/scrape/gallery'; +import { fetchGalleryData } from '@/utils/scrape/xvideos/gallery'; export default async function HomePage() { diff --git a/src/app/[locale]/search/[query]/page.tsx b/src/app/[locale]/search/[query]/page.tsx index 50a69a9..520d0bc 100644 --- a/src/app/[locale]/search/[query]/page.tsx +++ b/src/app/[locale]/search/[query]/page.tsx @@ -2,7 +2,7 @@ import Layout from "@/components/Layout"; import Search from "@/components/Pages/Search"; -import { fetchGalleryData } from "@/utils/scrape/gallery"; +import { fetchGalleryData } from "@/utils/scrape/xvideos/gallery"; export default async function SearchPage({ params }: { params: { query: string } }) { diff --git a/src/app/[locale]/video/[id]/page.tsx b/src/app/[locale]/video/[id]/page.tsx index ad7a23a..26d9593 100644 --- a/src/app/[locale]/video/[id]/page.tsx +++ b/src/app/[locale]/video/[id]/page.tsx @@ -4,10 +4,10 @@ import Layout from "@/components/Layout"; import Video from "@/components/Pages/Video"; -import { fetchVideoData } from "@/utils/scrape/video"; - import { decodeVideoUrlPath } from '@/utils/string'; +import { fetchVideoData } from '@/utils/scrape/xvideos/video'; + import { useLocale } from 'next-intl'; export default async function VideoPage({ params }: { params: { id: string } }) { diff --git a/src/utils/scrape/gallery.ts b/src/utils/scrape/xvideos/gallery.ts similarity index 96% rename from src/utils/scrape/gallery.ts rename to src/utils/scrape/xvideos/gallery.ts index 06038b5..51d617b 100644 --- a/src/utils/scrape/gallery.ts +++ b/src/utils/scrape/xvideos/gallery.ts @@ -3,7 +3,7 @@ import { GalleryData } from '@/meta/data'; import axios, { AxiosError } from 'axios'; import * as cheerio from "cheerio"; -import { getHeaders } from './headers'; +import { getHeaders } from '../headers'; interface FetchParams { baseUrl?: string diff --git a/src/utils/scrape/video.ts b/src/utils/scrape/xvideos/video.ts similarity index 96% rename from src/utils/scrape/video.ts rename to src/utils/scrape/xvideos/video.ts index 8313ce1..5c4d04b 100644 --- a/src/utils/scrape/video.ts +++ b/src/utils/scrape/xvideos/video.ts @@ -4,8 +4,8 @@ import { GalleryData, VideoData } from '@/meta/data'; import axios, { AxiosError } from 'axios'; import * as cheerio from "cheerio"; -import { findRelatedVideos, findVideoUrlInsideTagStringByFunctionNameAndExtension } from '../string'; -import { getHeaders } from './headers'; +import { findRelatedVideos, findVideoUrlInsideTagStringByFunctionNameAndExtension } from '../../string'; +import { getHeaders } from '../headers'; interface FetchParams { baseUrl?: string