twlite / youtube-sr

A dead-simple youtube metadata scraper
https://npmjs.com/package/youtube-sr
MIT License
115 stars 15 forks source link

Skypack complaining #10

Closed AZMCode closed 3 years ago

AZMCode commented 3 years ago

Hello! I´m a new user to this library (Which looks amazing btw), and have been trying it on Deno, however it seems when i call the search static method, skypack complains like so:

error: Uncaught (in promise) TypeError: node_fetch_1.default is not a function
        node_fetch_1.default(url, prop).then((res) => res.text()).then((html) => resolve(html)).catch((e) => reject(e));
                            ^
    at https://cdn.skypack.dev/-/youtube-sr@v3.0.0-9EZGCmCqXXj9Rp9BSVMd/dist=es2020/youtube-sr.js:269:29
    at new Promise (<anonymous>)
    at Function.getHTML (https://cdn.skypack.dev/-/youtube-sr@v3.0.0-9EZGCmCqXXj9Rp9BSVMd/dist=es2020/youtube-sr.js:267:14)
    at Function.search (https://cdn.skypack.dev/-/youtube-sr@v3.0.0-9EZGCmCqXXj9Rp9BSVMd/dist=es2020/youtube-sr.js:527:43)
    at getYoutubeVideo (mod.ts:26:35)
    at resolve (mod.ts:21:31)
    at async test.ts:7:9

The last three lines of the stack are mine, but I believe the rest might need some tweaking. I'll provide feedback on the bug as soon as requested. If any help finding this bug is needed, I'll drop in to the source code to help squash this. Cheerio!

twlite commented 3 years ago

🤔can you send your code here?

AZMCode commented 3 years ago

In a moment

AZMCode commented 3 years ago
import { YouTube } from "https://deno.land/x/youtube_sr/mod.ts";

await YouTube.search("Diddly Daddily");

Tested it and the bug persists

twlite commented 3 years ago

@AZMCode hmm weird, tested your code just now and it works fine 🙄

AZMCode commented 3 years ago

Image.png

AZMCode commented 3 years ago

Any troubleshooting I can do to pin this down? Already tried reloading demo cache but no result yet.

twlite commented 3 years ago

@AZMCode hm let me see again, maybe I was running cached version

AZMCode commented 3 years ago

Just updated deno to check it wasn't a Deno bug.

twlite commented 3 years ago

Thanks, I was running cached version, I will try to fix this asap 😊

AZMCode commented 3 years ago

Thanks mate

AZMCode commented 3 years ago

Went through the code a bit, it seems the error is being emitted from line 48 of Utils.ts

AZMCode commented 3 years ago

It's as if fetch wasn't a function, which is wild.

AZMCode commented 3 years ago

I sure hope this isn't a skypack bug.

twlite commented 3 years ago

🤔It should work now. (v3.0.3)

AZMCode commented 3 years ago

It indeed does. Thank you!

twlite commented 3 years ago

👍