egghead-downloader
egghead-downloader copied to clipboard
program stops after downloading a few files
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?
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?
doesn't work for me either
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 🎉
Run into the same issue as @corysimmons @markbrown4
There are two problems:
-
request
now has to be installed seperately and required explicitly in the download module. I also had to userequest-promise
or else it will not return the html reponse, but aRequest Object
, which will lead tohtml.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) -
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.
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 :)
@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 PR's are welcome from you too 😄
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.
~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.