muse icon indicating copy to clipboard operation
muse copied to clipboard

Option Proxy seems like not working

Open x7v4mibui opened this issue 2 years ago • 3 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/[email protected]";
//import { search, set_option } from "https://jspm.dev/npm:[email protected]";
//import { search, set_option } from "https://cdn.skypack.dev/[email protected]";
import * as muse from "https://esm.sh/[email protected]";
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);
});

image

tested on 0.0.97 and 0.0.31

x7v4mibui avatar Apr 20 '24 08:04 x7v4mibui

I am having the same issue too.

Doctorthe113 avatar Apr 20 '24 14:04 Doctorthe113

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/[email protected]/request.ts:52:12)
    at FetchClient.request (https://deno.land/x/[email protected]/request.ts:133:33)
    at load_visitor_id (https://deno.land/x/[email protected]/mixins/_request.ts:16:51)
    at request (https://deno.land/x/[email protected]/mixins/_request.ts:36:9)
    at async request_json (https://deno.land/x/[email protected]/mixins/_request.ts:88:20)
    at async search (https://deno.land/x/[email protected]/mixins/search.ts:293:22)

x7v4mibui avatar Apr 21 '24 07:04 x7v4mibui

You're correct. The proxy option hasn't worked in a while. I'll be working on it though.

vixalien avatar Apr 21 '24 10:04 vixalien

how to get around this @vixalien any help?

afkcodes avatar Jul 12 '24 15:07 afkcodes

not sure to be honest. I'm not familiar with using proxies in Deno or npm

vixalien avatar Jul 12 '24 21:07 vixalien

i was not able to call the api on localhost. so how to make it work. sorry for the dumb question

afkcodes avatar Jul 13 '24 10:07 afkcodes

what do you mean call the API on local host?

vixalien avatar Jul 15 '24 00:07 vixalien

@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

afkcodes avatar Jul 15 '24 17:07 afkcodes

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

vixalien avatar Jul 15 '24 17:07 vixalien

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);

vixalien avatar Jul 15 '24 22:07 vixalien

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

afkcodes avatar Jul 17 '24 21:07 afkcodes

oh yeah classic me 😅I forgot to push

vixalien avatar Jul 17 '24 21:07 vixalien

pushed!

vixalien avatar Jul 17 '24 21:07 vixalien

still not able to see the latest version on npm i think its not published yet.

afkcodes avatar Jul 18 '24 02:07 afkcodes

try version 0.0.104 on npm

vixalien avatar Jul 18 '24 10:07 vixalien