Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

program stops after downloading a few files #10

Open
picaron opened this issue Apr 22, 2018 · 9 comments
Open

program stops after downloading a few files #10

picaron opened this issue Apr 22, 2018 · 9 comments

Comments

@picaron
Copy link

picaron commented Apr 22, 2018

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?

@markbrown4
Copy link
Owner

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?

@BeKnowDo
Copy link

BeKnowDo commented May 8, 2018

doesn't work for me either

@corysimmons
Copy link

corysimmons commented May 27, 2018

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 🎉

@hrisng
Copy link

hrisng commented May 31, 2018

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.

@markbrown4
Copy link
Owner

markbrown4 commented May 31, 2018

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

@corysimmons
Copy link

@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. 😅

@markbrown4
Copy link
Owner

markbrown4 commented May 31, 2018

@corysimmons PR's are welcome from you too 😄

@hrisng
Copy link

hrisng commented May 31, 2018

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
Copy link

hrisng commented May 31, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants