r0oth3x49 / udemy-dl

A cross-platform python based utility to download courses from udemy for personal offline use.
MIT License
4.86k stars 1.2k forks source link

URLError : either your internet connection is not working or server aborted the request #450

Closed 7ang closed 5 years ago

7ang commented 5 years ago

Describe the bug This problem wasn't to the whole course, just some lectures of the course To Reproduce the course url is https://www.udemy.com/bpmn-for-business-analysts/

For this course, I save the links in the txtby --save command, and find something interesting The chapater 1 have 7 videos lecture, the first lecture url link is look like

https://a.udemycdn.com/2015-11-21_11-02-30-35814b43192d30d40365b79e6c847e63/WebHD_720p.mp4?nva=20191117111655&token=0089a0f7cfbc60276c154 (the first lecture was free to watch) which can de downloaded through udemy-dl

However the others url links look like https://a1003.udemycdn.com/2019-04-13_09-32-30-5624f70ce5a6e8ac074bf56200683a63/WebHD_720p.mp4?secure=zmhUcFzwnfxqrOLAKRipng%3D%3D%2C1573989415 (this is the second lectuer) which will raise an URLError

So I import urllib to see what happened in the python, the code was

python 3.6.4

import urllib.request req = urllib.request.Request('https://a1003.udemycdn.com/2019-04-13_09-32-30-5624f70ce5a6e8ac074bf56200683a63/WebHD_720p.mp4?secure=zmhUcFzwnfxqrOLAKRipng%3D%3D%2C1573989415',headers = {'User-Agent':'Mozilla/5.0'}) urllib.request.urlopen(req) it wiil raise the following error

image

But If I copy the second links to the Chrome, it can be downloaded indeed So I think maybe there maybe some setting to the urlib.request library, Cause I even used the requests library which rewrited based on urllib.request , it still can be downloaded

Screenshots If applicable, add screenshots to help explain your problem.

Python Environment (please complete the following information):

Additional context Add any other context about the problem here.