feedparser icon indicating copy to clipboard operation
feedparser copied to clipboard

"parse" generates error while parsing podcast URLs

Open rohshall opened this issue 9 years ago • 2 comments

% python3                                                                                                               
Python 3.5.1 (default, Mar  4 2016, 15:21:15) 
[GCC 6.0.0 20160302 (Red Hat 6.0.0-0.14)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import feedparser
>>> url = 'http://api.videos.ndtv.com/apis/podcast/index/client_key/ndtv-podcast-5d35e3e34a92df17d11d54e0ff241e8b?shows=503&showfull=1&media_type=audio&extra_params=keywords,description'
>>> feedparser.parse(url)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/site-packages/feedparser.py", line 3957, in parse
    saxparser.parse(source)
  File "/usr/lib64/python3.5/site-packages/drv_libxml2.py", line 190, in parse
    _d(reader.LocalName()))
  File "/usr/lib64/python3.5/site-packages/drv_libxml2.py", line 70, in _d
    return _decoder(s)[0]
  File "/usr/lib64/python3.5/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
TypeError: a bytes-like object is required, not 'str'
>>> feedparser.__version__
'5.2.0'
>>> 

rohshall avatar May 16 '16 00:05 rohshall

I'm seeing this too:

Traceback (most recent call last):
  File "/home/eqyiel/.local/bin/get_lectures.py", line 116, in <module>
    go("vod")
  File "/home/eqyiel/.local/bin/get_lectures.py", line 34, in go
    feed = feedparser.parse(target)
  File "/home/eqyiel/.local/lib/python3.5/site-packages/feedparser.py", line 3957, in parse
    saxparser.parse(source)
  File "/usr/lib/python3.5/site-packages/drv_libxml2.py", line 190, in parse
    _d(reader.LocalName()))
  File "/usr/lib/python3.5/site-packages/drv_libxml2.py", line 70, in _d
    return _decoder(s)[0]
  File "/usr/lib/python3.5/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
TypeError: a bytes-like object is required, not 'str'

eqyiel avatar May 29 '16 20:05 eqyiel

I have the same problem with the basic example from the documentation. I just changed the URL as the original file is not there anymore.

$ python3
Python 3.5.2 (default, Sep 14 2016, 11:28:32) 
[GCC 6.2.1 20160901 (Red Hat 6.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import feedparser
>>> d = feedparser.parse('https://raw.githubusercontent.com/urbanserj/feedparser/master/atom10.xml')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/site-packages/feedparser.py", line 3957, in parse
    saxparser.parse(source)
  File "/usr/lib64/python3.5/site-packages/drv_libxml2.py", line 189, in parse
    eltName = (_d(reader.NamespaceUri()),\
  File "/usr/lib64/python3.5/site-packages/drv_libxml2.py", line 70, in _d
    return _decoder(s)[0]
  File "/usr/lib64/python3.5/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
TypeError: a bytes-like object is required, not 'str'
>>>

Executed on Fedora 25, 64 bit, Python 3.5.2. Installed feedparse via: python3 -m pip install feedparser

guerda avatar Mar 12 '17 11:03 guerda