How to use the feedparser.feedparser.FeedParserDict function in feedparser

To help you get started, we’ve selected a few feedparser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kurtmckee / feedparser / feedparser / feedparser.py View on Github external
def _start_textinput(self, attrsD):
        self.intextinput = 1
        self.push('textinput', 0)
        context = self._getContext()
        context.setdefault('textinput', FeedParserDict())
    _start_textInput = _start_textinput
github kurtmckee / feedparser / feedparser / feedparser.py View on Github external
def _start_body(self, attrsD):
        self.incontent += 1
        self.contentparams = FeedParserDict({'mode': 'xml',
                              'type': 'application/xhtml+xml',
                              'language': attrsD.get('xml:lang', self.lang),
                              'base': attrsD.get('xml:base', self.baseuri)})
        self.push('content', 1)
    _start_xhtml_body = _start_body
github kurtmckee / feedparser / feedparser / feedparser.py View on Github external
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=[]):
    """Parse a feed from a URL, file, stream, or string"""
    result = FeedParserDict()
    result['feed'] = FeedParserDict()
    result['entries'] = []
    if _XML_AVAILABLE:
        result['bozo'] = 0
    if type(handlers) == types.InstanceType:
        handlers = [handlers]
    try:
        f = _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers)
        data = f.read()
    except Exception, e:
        result['bozo'] = 1
        result['bozo_exception'] = e
        data = ''
        f = None

    # if feed is gzip-compressed, decompress it
github kurtmckee / feedparser / feedparser / feedparser.py View on Github external
def _start_source(self, attrsD):
        if self.inentry:
            self.entries[-1]['source'] = FeedParserDict(attrsD)
        self.push('source', 1)
github kurtmckee / feedparser / feedparser / feedparser.py View on Github external
def _start_content_encoded(self, attrsD):
        self.incontent += 1
        self.contentparams = FeedParserDict({'mode': 'escaped',
                              'type': 'text/html',
                              'language': attrsD.get('xml:lang', self.lang),
                              'base': attrsD.get('xml:base', self.baseuri)})
        self.push('content', 1)
    _start_fullitem = _start_content_encoded
github kurtmckee / feedparser / feedparser / feedparser.py View on Github external
def _save_author(self, key, value):
        context = self._getContext()
        context.setdefault('author_detail', FeedParserDict())
        context['author_detail'][key] = value
        self._sync_author_detail()
github kurtmckee / feedparser / feedparser / feedparser.py View on Github external
def _start_copyright(self, attrsD):
        self.incontent += 1
        self.contentparams = FeedParserDict({'mode': attrsD.get('mode', 'escaped'),
                              'type': attrsD.get('type', 'text/plain'),
                              'language': attrsD.get('xml:lang', self.lang),
                              'base': attrsD.get('xml:base', self.baseuri)})
        self.push('copyright', 1)
    _start_dc_rights = _start_copyright
github kurtmckee / feedparser / feedparser / feedparser.py View on Github external
def _start_title(self, attrsD):
        self.incontent += 1
        self.contentparams = FeedParserDict({'mode': attrsD.get('mode', 'escaped'),
                              'type': attrsD.get('type', 'text/plain'),
                              'language': attrsD.get('xml:lang', self.lang),
                              'base': attrsD.get('xml:base', self.baseuri)})
        self.push('title', self.infeed or self.inentry)
    _start_dc_title = _start_title
github kurtmckee / feedparser / feedparser / feedparser.py View on Github external
def _save_contributor(self, key, value):
        context = self._getContext()
        context.setdefault('contributors', [FeedParserDict()])
        context['contributors'][-1][key] = value