You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have written a python code about extracting videos from coursera.But codes below can not be used.
It raises error "urllib.error.HTTPError: HTTP Error 403: FORBIDDEN"
I know jplehmann / coursera is a popular code for coursera and hope you can help me.
Thank you very much!
login_page = "https://www.coursera.org/account/signin"
def set_cookie(username,password):
cj = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor())
values = {"signin-email":username,
"signin-password":password,
"login:":"Login"}
data = urllib.parse.urlencode(values)
binary_data = data.encode(encoding='utf-8', errors='strict')
headers = {"User-Agent":"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6"}
req = urllib.request.Request(login_page,binary_data,headers)
opener.open(req)
with open("1.txt",encoding='utf-8',mode='w') as record_file:
op = opener.open("https://www.coursera.org")
record_file.write(op.read().decode('utf-8'))
The text was updated successfully, but these errors were encountered:
I don't think you can use that login anymore for authentication. We switch to the one presently in get_auth_url some time ago. If that fails, take our working copy and mutate it step by step until it's like your code to see on which step it fails.
I have written a python code about extracting videos from coursera.But codes below can not be used.
It raises error "urllib.error.HTTPError: HTTP Error 403: FORBIDDEN"
I know jplehmann / coursera is a popular code for coursera and hope you can help me.
Thank you very much!
The text was updated successfully, but these errors were encountered: