What can be used instead of parse_qs function
Question: I have the following code for parsing youtube feed and returning youtube movie
id. How can I rewrite this to be python 2.4 compatible which I suppose doesn't
support `parse_qs` function ?

    
    
    YTSearchFeed = feedparser.parse("http://gdata.youtube.com" + path)
    videos = []
    for yt in YTSearchFeed.entries:
        url_data = urlparse.urlparse(yt['link']) 
        query = urlparse.parse_qs(url_data[4])
        id = query["v"][0]
        videos.append(id) 
    


Answer: I assume your existing code runs in 2.6 or something newer, and you're trying
to go back to 2.4? `parse_qs` used to be in the `cgi` module before it was
moved to `urlparse`. Try `import cgi`, `cgi.parse_qs`.

Inspired by [TryPyPy's](http://stackoverflow.com/users/555569/trypypy)
comment, I think you could make your source run in either environment by
doing:

    
    
    import urlparse # if we're pre-2.6, this will not include parse_qs
    try:
        from urlparse import parse_qs
    except ImportError: # old version, grab it from cgi
        from cgi import parse_qs
        urlparse.parse_qs = parse_qs
    

But I don't have 2.4 to try this out, so no promises.

