aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Tools/EpisodeDiscussionCollector.svelte
blob: a9acd8aef9aa4f6d2875eb971231527aee9e31e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<script lang="ts">
	import { threads } from '$lib/AniList/forum';

	let searchInput = '';
	let searchInputFinal = '';
</script>

<p>
	<input type="text" placeholder="Username" bind:value={searchInput} />
	<a href={`#`} on:click={() => (searchInputFinal = searchInput)}>Search</a>
</p>

{#if searchInputFinal !== ''}
	{#await threads(searchInputFinal)}
		Loading ...
	{:then threads}
		<ul>
			{#each threads
				.filter((thread) => thread.title.includes('[Spoilers]') && thread.title.includes('Episode'))
				.sort((a, b) => b.createdAt - a.createdAt) as thread}
				<li>
					<a href={`https://anilist.co/forum/thread/${thread.id}`} target="_blank">
						{thread.title.replace('[Spoilers]', '')}
					</a>
				</li>
			{/each}
		</ul>
	{:catch}
		<p>
			Threads could not be loaded. You might have been <a
				href="https://en.wikipedia.org/wiki/Rate_limiting"
				target="_blank">rate limited</a
			>.
		</p>
		<p>
			Try again in a few minutes. If the problem persists, please contact <a
				href="https://anilist.co/user/fuwn"
				target="_blank">@fuwn</a
			> on AniList.
		</p>
	{/await}
{:else}
	<p>Enter a username to search for to continue.</p>
{/if}