egghead-downloader icon indicating copy to clipboard operation
egghead-downloader copied to clipboard

program stops after downloading a few files

Open picaron opened this issue 6 years ago • 9 comments

I'm getting this error:

events.js:180
    throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'listener', 'Function');
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type Function
    at _addListener (events.js:180:11)
    at WriteStream.addListener (events.js:240:10)
    at WriteStream.close (fs.js:2302:10)
    at WriteStream.<anonymous> (/Users/pascal.chouinard/Dropbox/Videos/Egghead/egghead-downloader/src/download.coffee:78:14)
    at WriteStream.emit (events.js:164:20)
    at finishMaybe (_stream_writable.js:605:14)
    at afterWrite (_stream_writable.js:456:3)
    at onwrite (_stream_writable.js:446:7)
    at fs.js:2246:5
    at FSReqWrap.wrapper [as oncomplete] (fs.js:703:5)

@markbrown4 what version of node did you test with?

picaron avatar Apr 22 '18 01:04 picaron

Hey,

I've just tried the following with Node v8.9.0 and it seems happy. npm run download https://egghead.io/courses/optimistic-ui-updates-in-react

Which video series did you try and download?

markbrown4 avatar Apr 22 '18 07:04 markbrown4

doesn't work for me either

BeKnowDo avatar May 08 '18 19:05 BeKnowDo

npm run download https://egghead.io/courses/up-and-running-with-redux-observable just creates an empty nested directory. Node 8.10 (I did have to update some pkgs in package.json because npm audit was crying, and I had to manually npm i request or it threw an error telling me to do so..)

your series fails too:

Fetching: https://egghead.io/courses/optimistic-ui-updates-in-react

Writing: videos/optimistic-ui-updates-in-react

All Done 🎉

corysimmons avatar May 27 '18 02:05 corysimmons

Run into the same issue as @corysimmons @markbrown4

There are two problems:

  1. request now has to be installed seperately and required explicitly in the download module. I also had to use request-promise or else it will not return the html reponse, but a Request Object, which will lead to html.includes in not a function (Edit: didn't see that you set the global request in the program file, still, doing as above somehow solve that problem)
  2. Egghead.io page for course is no longer fully server side rendered. So we can't get the lessons link. I suggest parsing the json from api instead, https://egghead.io/api/v1/series/use-types-effectively-in-typescript/lessons

Wanting to save time, so I came upon this repo. Though I'm writing my own solution now, I hope this info can be useful for you.

hrisng avatar May 31 '18 13:05 hrisng

Thanks @harrisnguyen94, you're on the right track with the missing links in the HTML response now.

If you're able to modify the script to hit the API a PR would be welcome :)

markbrown4 avatar May 31 '18 14:05 markbrown4

@harrisnguyen94 Can you open-source/gist your solution when you get something that works pretty well. It seems they update the site as fast as we can make downloader scripts. 😅

corysimmons avatar May 31 '18 15:05 corysimmons

@corysimmons PR's are welcome from you too 😄

markbrown4 avatar May 31 '18 15:05 markbrown4

CORS, I was trigger-happy. Though I will see if I can find another way tomorrow, as I really need this. Definitely will create a PR if I can make it works.

hrisng avatar May 31 '18 15:05 hrisng

~A hint is that this url is still fully server side rendered https://egghead.io/lessons, and we can successfully get the link from it.~ Nevermind, it's late and I say stupid things.

hrisng avatar May 31 '18 15:05 hrisng