Hacked around build errors
This commit is contained in:
parent
14fc1fbce6
commit
f7031852a7
|
|
@ -10,9 +10,9 @@ export default function Search() {
|
||||||
const [query, setQuery] = useState<string>("");
|
const [query, setQuery] = useState<string>("");
|
||||||
const [result, setResult] = useState<Serie[]>([]);
|
const [result, setResult] = useState<Serie[]>([]);
|
||||||
|
|
||||||
const onSearch = async (event) => {
|
const onSearch = async (event: any) => {
|
||||||
|
|
||||||
const [status, response] = await post("/api/search", {
|
const [status, response] = await post<any>("/api/search", {
|
||||||
query
|
query
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ export default function Search() {
|
||||||
placeholder="NRK-podcast"
|
placeholder="NRK-podcast"
|
||||||
className="border-2"
|
className="border-2"
|
||||||
value={query}
|
value={query}
|
||||||
onInput={(event) => { setQuery(event.target.value) }} />
|
onInput={(event: any) => { setQuery(event.target.value) }} />
|
||||||
<button
|
<button
|
||||||
className="my-2 bg-gray-100"
|
className="my-2 bg-gray-100"
|
||||||
onClick={onSearch}>Søk</button>
|
onClick={onSearch}>Søk</button>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export type Episode = {
|
||||||
async function withDownloadLink(withoutUrl: Omit<Episode, "url">) {
|
async function withDownloadLink(withoutUrl: Omit<Episode, "url">) {
|
||||||
|
|
||||||
// getting stream link
|
// getting stream link
|
||||||
const [playbackStatus, playbackResponse] = await get(`https://psapi.nrk.no/playback/manifest/podcast/${withoutUrl.episodeId}`)
|
const [playbackStatus, playbackResponse] = await get<any>(`https://psapi.nrk.no/playback/manifest/podcast/${withoutUrl.episodeId}`)
|
||||||
|
|
||||||
if (playbackStatus === OK) {
|
if (playbackStatus === OK) {
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ async function withDownloadLink(withoutUrl: Omit<Episode, "url">) {
|
||||||
|
|
||||||
export const nrkRadio = {
|
export const nrkRadio = {
|
||||||
search: async (query: string): Promise<Serie[]> => {
|
search: async (query: string): Promise<Serie[]> => {
|
||||||
const [status, response] = await get(`https://psapi.nrk.no/radio/search/search?q=${query}`);
|
const [status, response] = await get<any>(`https://psapi.nrk.no/radio/search/search?q=${query}`);
|
||||||
if (status === OK) {
|
if (status === OK) {
|
||||||
const series = response.results.series.results
|
const series = response.results.series.results
|
||||||
return series as Serie[];
|
return series as Serie[];
|
||||||
|
|
@ -54,8 +54,8 @@ export const nrkRadio = {
|
||||||
[episodeStatus, episodeResponse],
|
[episodeStatus, episodeResponse],
|
||||||
[seriesStatus, serieResponse],
|
[seriesStatus, serieResponse],
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
get(`https://psapi.nrk.no/radio/catalog/podcast/${seriesId}/episodes`),
|
get<any>(`https://psapi.nrk.no/radio/catalog/podcast/${seriesId}/episodes`),
|
||||||
get(`https://psapi.nrk.no/radio/catalog/podcast/${seriesId}`)
|
get<any>(`https://psapi.nrk.no/radio/catalog/podcast/${seriesId}`)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,23 @@ import { HandlerContext } from "$fresh/server.ts";
|
||||||
|
|
||||||
import { serialize, tag, declaration } from "https://deno.land/x/serializexml@v0.3.2/mod.ts";
|
import { serialize, tag, declaration } from "https://deno.land/x/serializexml@v0.3.2/mod.ts";
|
||||||
|
|
||||||
function toItemTag(episode: Episode): string {
|
function toItemTag(episode: Episode) {
|
||||||
return tag("item", [
|
return tag("item", [
|
||||||
tag("title", episode.title),
|
tag("title", episode.titles.title),
|
||||||
tag("link", episode.url),
|
tag("link", episode.url),
|
||||||
tag("description", episode.description),
|
tag("description", episode.titles.description),
|
||||||
tag("itunes:summary", episode.description),
|
tag("itunes:summary", episode.titles.description),
|
||||||
tag("guid", episode.id, ["isPermaLink", "false"]),
|
tag("guid", episode.id, [["isPermaLink", "false"]]),
|
||||||
tag("pubDate", episode.date),
|
tag("pubDate", episode.date),
|
||||||
tag("enclosure", "", [
|
tag("enclosure", "", [
|
||||||
["url", episode.url],
|
["url", episode.url],
|
||||||
["length", episode.durationInSeconds],
|
["length", episode.durationInSeconds.toString()],
|
||||||
["type", "audio/mpeg3"],
|
["type", "audio/mpeg3"],
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
async function buildFeed(seriesId) {
|
async function buildFeed(seriesId: any) {
|
||||||
const serie = await nrkRadio.getSerieData(seriesId)
|
const serie = await nrkRadio.getSerieData(seriesId)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue