diff --git a/src/components/search/Creator.astro b/src/components/search/Creator.astro new file mode 100644 index 0000000..802af0b --- /dev/null +++ b/src/components/search/Creator.astro @@ -0,0 +1,59 @@ +--- +const { + Name, + Avatar, + Link, + Platform, + Banner, + Followers +} = Astro.props +--- + + +
+

{Followers}

+ {Name + {Name +
+
+

{Name}

+
+
+ + \ No newline at end of file diff --git a/src/pages/search.astro b/src/pages/search.astro index 1fb3548..97d8ae9 100644 --- a/src/pages/search.astro +++ b/src/pages/search.astro @@ -4,6 +4,7 @@ import Base from '@layouts/Default.astro' // Components import Video from '@components/common/VideoItem.astro' +import Creator from '@components/search/Creator.astro' // Environment Variables const DEFAULT_INVIDIOUS_INSTANCE = import.meta.env.DEFAULT_INVIDIOUS_INSTANCE @@ -15,6 +16,10 @@ const InvidiousResponse = await fetch('https://' + DEFAULT_INVIDIOUS_INSTANCE + .catch((error) => { console.log(error) }) +const InvidiousChannelsResponse = await fetch('https://' + DEFAULT_INVIDIOUS_INSTANCE + "/api/v1/search?q=" + Query + '&type=channel') +.catch((error) => { + console.log(error) +}) const TwitchResponse = await fetch('https://' + DEFAULT_SAFETWITCH_BACKEND + "/api/search/?query=" + Query) .catch((error) => { @@ -22,6 +27,7 @@ const TwitchResponse = await fetch('https://' + DEFAULT_SAFETWITCH_BACKEND + "/a }) const InvidiousData = await InvidiousResponse.json() +const InvidiousChannelsData = await InvidiousChannelsResponse.json() const TwitchData = await TwitchResponse.json() --- @@ -29,25 +35,36 @@ const TwitchData = await TwitchResponse.json()

Search

-

Twitch Channels related to "{Query}"

+

YouTube creators related to "{Query}"

+
+ {InvidiousChannelsData.map((channel) => + + )} +
+

Twitch creators related to "{Query}"

{TwitchData.data.channels.map((channel) => - - -
- -
-

{channel.username}

-

{channel.about}

-
-
-
+ )}

Twitch Live streams with the tag "{Query}"

{TwitchData.data.relatedChannels.map((channel) => -