0

I have correctly initialized YouTubeService. I can move/delete/rename playlist entries, but when I try to delete playlist I get unhelpfull exception:

_service = None

def get_service():
    global _service

    if _service is None:
        _service = YouTubeService()
        gdata.alt.appengine.run_on_appengine(_service)
        _service.developer_key = settings.YTMANAGER_DEVELOPER_KEY

        if 'token' in get_request().session:
            _service.SetAuthSubToken(get_request().session['token'])

    return _service

def test(request):
    get_service().DeletePlaylist('http://gdata.youtube.com/feeds/api/playlists/921AC6352FE6931F')
    return HttpResponse('ok')

Exception:

Exception Type:  RequestError
Exception Value: {'status': 400, 'body': 'Invalid request URI', 'reason': ''}
Exception Location: \gdata\service.py in Delete, line 1454
4

1 回答 1

0

文档(http://code.google.com/apis/youtube/1.0/developers_guide_python.html#DeletePlaylists)已过时或这是错误,但 DeletePlaylist 需要“完整”链接:

http://gdata.youtube.com/feeds/api/users/username/playlists/921AC6352FE6931F

因为 GetYouTubePlaylistVideoFeed 方法需要“短”链接才能使用 max-results 参数:

http://gdata.youtube.com/feeds/api/playlists/921AC6352FE6931F
于 2010-09-22T19:12:17.420 回答