Beispiel #1
0
def delete_comment():
    video_id = request.values['video_id']
    cookiejar = accounts.account_cookiejar(request.values['channel_id'])
    token = get_session_token(video_id, cookiejar)

    code = _delete_comment(video_id, request.values['comment_id'], token,
                           cookiejar)

    if code == "SUCCESS":
        return flask.redirect(util.URL_ORIGIN + '/comment_delete_success', 303)
    else:
        return flask.redirect(util.URL_ORIGIN + '/comment_delete_fail', 303)
Beispiel #2
0
def delete_comment(env, start_response):
    parameters = env['parameters']
    video_id = parameters['video_id'][0]
    cookiejar = accounts.account_cookiejar(parameters['channel_id'][0])
    token = get_session_token(video_id, cookiejar)

    code = _delete_comment(video_id, parameters['comment_id'][0],
                           parameters['author_id'][0], token, cookiejar)

    if code == "SUCCESS":
        start_response('303 See Other', [
            ('Location', util.URL_ORIGIN + '/comment_delete_success'),
        ])
    else:
        start_response('303 See Other', [
            ('Location', util.URL_ORIGIN + '/comment_delete_fail'),
        ])
Beispiel #3
0
def post_comment():
    video_id = request.values['video_id']
    channel_id = request.values['channel_id']
    cookiejar = accounts.account_cookiejar(channel_id)
    token = get_session_token(video_id, cookiejar)

    if 'parent_id' in request.values:
        code = _post_comment_reply(request.values['comment_text'],
                                   request.values['video_id'],
                                   request.values['parent_id'], token,
                                   cookiejar)
        return flask.redirect(
            util.URL_ORIGIN + '/comments?' +
            request.query_string.decode('utf-8'), 303)
    else:
        code = _post_comment(request.values['comment_text'],
                             request.values['video_id'], token, cookiejar)
        return flask.redirect(
            util.URL_ORIGIN + '/comments?ctoken=' +
            comments.make_comment_ctoken(video_id, sort=1), 303)
Beispiel #4
0
def post_comment(env, start_response):
    parameters = env['parameters']
    video_id = parameters['video_id'][0]
    channel_id = parameters['channel_id'][0]
    cookiejar = accounts.account_cookiejar(channel_id)
    token = get_session_token(video_id, cookiejar)

    if 'parent_id' in parameters:
        code = _post_comment_reply(parameters['comment_text'][0],
                                   parameters['video_id'][0],
                                   parameters['parent_id'][0], token,
                                   cookiejar)
        start_response('303 See Other',
                       (('Location', util.URL_ORIGIN + '/comments?' +
                         env['QUERY_STRING']), ))

    else:
        code = _post_comment(parameters['comment_text'][0],
                             parameters['video_id'][0], token, cookiejar)
        start_response('303 See Other',
                       (('Location', util.URL_ORIGIN + '/comments?ctoken=' +
                         comments.make_comment_ctoken(video_id, sort=1)), ))

    return b''