ym-api
Version:
A Node.js wrapper for the Yandex.Music API (Unofficial) http://music.yandex.ru
13 lines (11 loc) • 367 B
text/typescript
import Request from "../Request";
import { URL } from "url";
export default function directLinkRequest(url: string) {
const parsedUrl = new URL(url);
return new Request({
scheme: parsedUrl.protocol.replace(":", ""),
host: parsedUrl.host,
port: parsedUrl.protocol === "https:" ? 443 : 80,
path: `${parsedUrl.pathname}${parsedUrl.search}`,
});
}