dimones / feedparser

Automatically exported from code.google.com/p/feedparser
Other
0 stars 0 forks source link

Content of media elements joined under media:group #397

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Parse attached feed.

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' 
xmlns:media='http://search.yahoo.com/mrss/' 
xmlns:gd='http://schemas.google.com/g/2005' 
xmlns:gml='http://www.opengis.net/gml' 
xmlns:yt='http://gdata.youtube.com/schemas/2007' 
xmlns:georss='http://www.georss.org/georss' 
gd:etag='W/&quot;DUcMQX0zfyp7I2A9WhBWEUg.&quot;'>
    <entry>
        <title>Random title</title>
        <media:group>
            <media:credit role='uploader'>Foo</media:credit>
            <media:description type='plain'>Random text</media:description>
        </media:group>
    </entry>
</feed>

2. Run code

import feedparser
import pprint

d = feedparser.parse("feed.xml")

pprint.pprint(d)

->

{'bozo': 0,
 'encoding': 'utf-8',
 'entries': [{'media_credit': {'role': 'uploader'},
              'media_description': {'type': 'plain'},
              'media_group': 'Foo\n\t\t\tRandom text',
              'title': 'Random title',
              'title_detail': {'base': '',
                               'language': None,
                               'type': 'text/plain',
                               'value': 'Random title'}}],
 'feed': {},
 'namespaces': {'': 'http://www.w3.org/2005/Atom',
                'gd': 'http://schemas.google.com/g/2005',
                'georss': 'http://www.georss.org/georss',
                'gml': 'http://www.opengis.net/gml',
                'media': 'http://search.yahoo.com/mrss/',
                'yt': 'http://gdata.youtube.com/schemas/2007'},
 'version': 'atom10'}

3. Elements "media:credit" and "media:description" have no content. Element 
"media:group" has content of both previous elements.

What is the expected output? What do you see instead?
The content of element should not be under other element.

What version of the product are you using? On what operating system?
Source version from Jan 31, 2013 (r2e61129cde93). Windows XP with Python 3.3.

Original issue reported on code.google.com by fbe...@gmail.com on 5 Apr 2013 at 11:36

Attachments:

GoogleCodeExporter commented 9 years ago
I'm not able to reproduce this behavior in git master using Python 3.3. Would 
you double-check that you're using git master HEAD (currently at f92190e7) and 
verify the results? For reference, I'm seeing this (trimmed) output:

 'entries': [{'credit': 'Foo',
              'media_credit': [{'content': 'Foo', 'role': 'uploader'}],
              'summary': 'Random text',
              'title': 'Random title',

If you're still seeing this output would you please try:

import feedparser
print(feedparser.__file__)

and verify that the file is being imported from the location you're expecting 
it to be imported from?

Original comment by kurtmckee on 10 May 2013 at 3:51

GoogleCodeExporter commented 9 years ago
You are correct. After testing feedparser (f92190e7) output was correct. Also 
version r2e61129cde93 worked after downloading it again. Problem was in the 
version in my computer. Sorry for the inconvenience.

Original comment by fbe...@gmail.com on 11 May 2013 at 9:25

GoogleCodeExporter commented 9 years ago
No inconvenience at all! =)

Original comment by kurtmckee on 11 May 2013 at 2:00