Paul Rubin wrote: > Wolfgang Draxinger <[EMAIL PROTECTED]> writes: >> Am I just blind for some urllib2/httplib feature, or some >> other library? Or do I really have to fiddle around with >> sockets myself (I hope not...). > > I did something like that by just opening a socket and writing > the > stuff with socket.sendall. It's only about 5 lines of code and > it's pretty straightforward.
Well, for YouTube you've to fiddle around with cookies, form/multipart data and stuff like that. It's a bit more than just opening a socket, there's some serious HTTP going on. However I found a solution: The curl program, that comes with libcurl and can be found on most *nix systems allows to do pretty sophisticated HTTP requests, among them also sending files by POST. So instead of using urllib2 or sockets from Python, now my program just generates the appropriate calls to curl, provides the in memory storage of cookies and does the neccesary HTML parsing*. Wolfgang Draxinger *) YouTube uploads videos in a two part process: First you set the various video options, in return you get a form with some hidden input fields, some of them providing a handle to the already sent video information. That data has to be extracted from the form and be put into the POST that also transfers the video file. -- E-Mail address works, Jabber: [EMAIL PROTECTED], ICQ: 134682867 -- http://mail.python.org/mailman/listinfo/python-list