barakagb / gb-dl

A python based utility to download courses from infosec4tc.teachable.com , academy.ehacking.net and stackskills.com for personal offline use.
https://pypi.org/project/gb-dl/
MIT License
39 stars 14 forks source link

Cookie #32

Closed flatlinebb closed 4 years ago

flatlinebb commented 4 years ago

Can you please provide more instructions on how to use the cookie for authentication? What format should the cookie be in? Can I stack the "-c cookies.txt -b -a" switches in one command? I keep getting cookie authentication failed, even if I export the cookies from my browser right before trying the script, using the cookies.txt chrome extension. I also visited the course page and verified I can access it. Is there a verbose switch to get more details what is failing? I have donated $5 for a key, because I want to support you and your project. Having more details instructions is not too much to ask.

Thanks!

barakagb commented 4 years ago

Hi @flatlinebb , kindly note that you only need to extract the value of _session_id from the cookies.(simply copy the value and paste it in txt file then -c FILENAME.txt do not add anything else in the file) You can use -h for help.

-c will load cookie value from file -b will store the cookie -a will autoload the cookie from the stored cookies

so it would make sense to use -c and -b in one command

Thanks.

flatlinebb commented 4 years ago

Hi, Thank you so much for your response. I have been trying different variants of adding the value of the _session_id value to the txt file. From the line (redacted for privacy): stackskills.com FALSE / TRUE 16xxxxxxx6 _session_id xxxxxxxxxxxxxxxxxxxxxxxxxxcb I have taken just the value xxxxxxxxxxxxxxxxxxxxxxxxxxcb and using the command: gb-dl.py -c cookie.txt -b -a I get the error: [-] Error: 'NoneType' object has no attribute 'group'

If I put the whole line in the file, I get the same error. The only time I get no error, but a message that "[-] Cookie authentication failed!" is when I put the whole content of the cookies.txt in the file.

Also, I did look at the -h option and saw the command switches, but since you do not provide a single example of the syntax using these switches anywhere on your github page, I wanted to get confirmation I was using them correctly, and perhaps causing my own issues with authentication.

I appreciate your continued assistance with your script.

flatlinebb commented 4 years ago

Well, I have figured out the problem, by searching around the Internet for how programs expect the cookie info to look and found the correct syntax of the cookie.txt file. It should contain the single line as follows: (again, redacted for privacy) _session_id=bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxb Your explanation suggested that only the part after the equal sign was needed, not even mentioning the fact that the equal sign was needed there at all.

I have another question now, regarding the naming format of the downloaded course files. I know what you are using youtube-dl in your script, and that it is capable of naming the video files with a certain scheme. The files that are downlaoded with your script, while nicely organized into a folder with the course name, and subfolders names with sub-sections, the files themselves are very generic. For example: WebHD_720p.mp4-1osdfafdsf9d.mp4

Is there a way to control that? Can I edit some config file and set my own pattern for the file name? For example, the following pattern works nicely and makes the individual course videos clearly labeled: Course Name/%(chapter_number)s-%(chapter)s/%(autonumber)03d-%(title)s.%(ext)s Resulting in a file named like this: 012-Basic Cookie Baking (Part 1).mp4

As always, all help is greatly appreciated.

barakagb commented 4 years ago

I am glad you made it work :) .However the way the script accepts the cookie is only by the cookie value suggesting it worked different for you is something that I have to look into . Kindly share the screenshot of the errors and the course url so I can look into it b'cause it sounds weird to me.

The course file names differ from one course to another ...some courses will have well labeled filenames while other will have generic names like so. For it is not possible to to set your own pattern but I understand the importance of it and will add it in a future release.

Thanks