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

A question about python code about extracting videos from coursera. #71

Closed
wangtengchao opened this issue Mar 9, 2013 · 3 comments
Closed

Comments

@wangtengchao
Copy link

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'))
@jplehmann
Copy link
Contributor

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.

@jplehmann jplehmann reopened this Mar 10, 2013
@rbrito
Copy link
Member

rbrito commented Mar 23, 2013

Should we close this issue (which was actually a question)?

@jplehmann
Copy link
Contributor

Yea, and besides any question about authentication from before are stale at
this point.

On Sat, Mar 23, 2013 at 9:58 AM, Rogério Brito notifications@github.comwrote:

Should we close this issue (which was actually a question)?


Reply to this email directly or view it on GitHubhttps://github.com/jplehmann/coursera/issues/71#issuecomment-15338365
.

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

No branches or pull requests

3 participants