google-code-export / feedparser

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

media:group with sub-items hides the sub items #335

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
>>> import feedparser # 5.1.1
>>> fp = 
feedparser.parse('http://gdata.youtube.com/feeds/api/videos/YquEJpyZ_3U?v=2')
>>> fp.entries[0].media_group
u'bestofattenboroughLike dolphins, whales communicate using sound. Humpbacks 
especially have extremely complex communication systems.youtubeBD BE BF BG BA 
BB WF BL BM BN BO BH BI BJ BT JM BV BW WS BR BS JE BY BZ RU RW RS LT RE LU LR 
RO LS GW GU GT GS GR GQ GP JP GY GG GF GE GD GB GA SV GN GM GL KW GI GH OM JO 
HR HT HU HK HN LV HM AD PR PS PW PT KR PY AI PA PF PG PE PK PH PN PL PM ZM EH 
EE EG ZA EC AL AO KZ ET ZW KY ES ER ME MD MG MF MA MC UZ MM ML MO MN MH US MU 
MT MW MV MQ MP MS MR AU UG MY MX VU FR IO AF AX FI FJ FK FM FO NI NL NO NA NC 
NE NF NG NZ NP NR NU CK CI CH CO CN CM CL CC CA CG CF CD CZ CY CX CR KP CV CU 
SZ SY KG KE ZZ SR KI KH KN KM ST SK SJ SI SH SO SN SM SL SC SB SA SG SE SD DO 
DM DJ DK DE YE AT DZ MK UY YT UM TZ LC LA TV TW TT TR LK LI TN TO TL TM TJ TK 
TH TF TG TD TC LY VA VC AE VE AG VG IQ VI IS IR AM IT VN AN AQ AS AR IM IL AW 
IN LB AZ IE ID UA QA MZ'
>>> fp.entries[0].description
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vagrant/lib/python2.6/site-packages/feedparser.py", line 423, in __getattr__
    raise AttributeError, "object has no attribute '%s'" % key
AttributeError: object has no attribute 'description'

What is the expected output? What do you see instead?

This is the combined content of all the tags within the <media:group>: 
<media:credit>, <media:description>, and <media:restriction>.  In addition, the 
content of the subtags aren't available on their own.  This makes it 
impossible, for example, to just get the description.

It's probably not backwards compatible, but I'd think that 
fp.entries[0].media_group should return a dictionary of the tags it contains, 
rather than all the contents.  If that's not possible, just making the subtags 
available individually would work.

Original issue reported on code.google.com by paulswa...@gmail.com on 29 Mar 2012 at 6:46

GoogleCodeExporter commented 9 years ago
I filed https://github.com/kurtmckee/feedparser/pull/4 to address this issue.

Original comment by paulswa...@gmail.com on 29 Mar 2012 at 7:26

GoogleCodeExporter commented 9 years ago

Original comment by kurtmckee on 28 May 2012 at 3:15

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 39a85a13c44a.

Original comment by kurtmckee on 13 Jan 2013 at 10:58