Option Proxy seems like not working
x7v4mibui opened this issue · 15 comments
Code:
<!doctype html> <!-- i think this is not related with issue, look JS code block below -->
<html lang="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>YouTube Music</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/youtubemusic.css">
<meta name="description" content="">
<meta property="og:title" content="YouTube Music">
<meta property="og:site_name" content="YouTube Music">
<meta name="description" content="Unofficial YouTube Music Web">
<meta property="og:type" content="website">
<!--
<meta property="og:url" content="https://music.youtube.com/">
<meta property="al:ios:app_name" content="YouTube Music">
<meta property="al:android:app_name" content="YouTube Music">
<meta name="twitter:url" content="https://music.youtube.com/">
<meta name="twitter:app:name:iphone" content="YouTube Music">
<meta name="twitter:app:name:ipad" content="YouTube Music">
<meta property="og:image" content="">
<meta property="og:image:alt" content="">
-->
<link rel="icon" href="https://music.youtube.com/favicon.ico" sizes="16x16" type="image/x-icon">
<link rel="icon" href="https://music.youtube.com/img/favicon_32.png" sizes="32x32" type="image/png">
<link rel="icon" href="https://music.youtube.com/img/favicon_48.png" sizes="48x48" type="image/png">
<link rel="icon" href="https://music.youtube.com/img/favicon_96.png" sizes="96x96" type="image/png">
<link rel="icon" href="https://music.youtube.com/img/favicon_144.png" sizes="144x144" type="image/png">
<link rel="apple-touch-icon" href="https://music.youtube.com/img/favicon_96.png">
<link rel="manifest" href="youtubemusic.webmanifest">
</head>
<body>
<p>Hellified world!</p>
<script src="js/youtubemusic.js" type="module"></script>
</body>
</html>
//import { search, set_option } from "https://esm.sh/libmuse@0.0.97";
//import { search, set_option } from "https://jspm.dev/npm:libmuse@0.0.97";
//import { search, set_option } from "https://cdn.skypack.dev/libmuse@0.0.97";
import * as muse from "https://esm.sh/libmuse@0.0.97";
muse.set_option("proxy", "http://45.32.254.253:8000/"); // VPS Running(deleted now): https://raw.githubusercontent.com/justjavac/deno_deploy_cors_proxy/main/main.ts
muse.search("top radio").then(data => {
console.log("search results", data);
});
tested on 0.0.97 and 0.0.31
I am having the same issue too.
tried to block connect music.youtube.com(and more)
I think use_proxy(url): string(URL) should be also in FetchClient, but it is not.
error: Uncaught (in promise) PermissionDenied: Requires net access to "music.youtube.com", run again with the --allow-net flag
return fetch(url, {
at FetchClient.do_request (https://deno.land/x/muse@0.0.97/request.ts:52:12)
at FetchClient.request (https://deno.land/x/muse@0.0.97/request.ts:133:33)
at load_visitor_id (https://deno.land/x/muse@0.0.97/mixins/_request.ts:16:51)
at request (https://deno.land/x/muse@0.0.97/mixins/_request.ts:36:9)
at async request_json (https://deno.land/x/muse@0.0.97/mixins/_request.ts:88:20)
at async search (https://deno.land/x/muse@0.0.97/mixins/search.ts:293:22)
You're correct. The proxy option hasn't worked in a while. I'll be working on it though.
not sure to be honest. I'm not familiar with using proxies in Deno or npm
i was not able to call the api on localhost. so how to make it work. sorry for the dumb question
what do you mean call the API on local host?
@vixalien i was basically saying that i am getting cors when running locally, libmuse internally calls innertube api i guess. so i was asking is there a way to get around this ? how do you use it while your development of muzika
Oh you're trying to access the API in the browser? In that case you need a proxy and need some way to make it work again.
I'm sorry, but until the proxy works, you won't be able to use muse in the browser
Fixed. You can use any custom proxy by setting the fetch
option. See the https://github.com/vixalien/muse/blob/main/examples/proxy.ts example for an example:
import * as muse from "../mod.ts";
muse.set_option("fetch", (url, options) => {
return fetch(`https://proxy.mangaraiku.eu.org/?url=${url}`, options);
});
const results = await muse.search("hello_world");
console.log("search results", results);
i am not using deno @vixalien , i am using node. Thanks for the quick fix. you are amazing. can you push the latest version on npm
oh yeah classic me 😅I forgot to push
pushed!
still not able to see the latest version on npm i think its not published yet.
try version 0.0.104 on npm