How to parse the “” using feedparser?

后端 未结 2 748
眼角桃花
眼角桃花 2021-02-06 13:16

The rss file is shown as below, i want to get the content in section media:group . I check the document of feedparser, but it seems not mention this. How to do

2条回答
  •  盖世英雄少女心
    2021-02-06 13:56

    feedparser 4.1 as available from PyPi has this bug.

    the solution for me was to get the latest feedparser.py (4.2 pre) from the repository.

    svn checkout http://feedparser.googlecode.com/svn/trunk/ feedparser-readonly
    cd feedparser-readonly
    python setup.py install
    

    now you can access all mrss items

    >>> import feedparser  # the new version!
    >>> d = feedparser.parse(MY_XML_URL)
    >>> for content in d.entries[0].media_content: print content['url']
    

    should do the job for you

提交回复
热议问题