Process feedly xml with Python.

Requirement: List blogs subscribed to feedly (markdown notation)

Get the RSS you subscribe to with the RSS reader feedly.

The contents of the data in XML file format are as follows.

xml feedly.opml.xml



<?xml version="1.0" encoding="UTF-8"?>

<opml version="1.0">
    <head>
        <title>xxxx subscriptions in feedly Cloud</title>
    </head>
    <body>
        <outline text="game" title="game">
            <outline type="rss" text="Update Information | PlayStation Official Site" title="Update Information | PlayStation Official Site" xmlUrl="http://www.jp.playstation.com/whatsnew/whatsnew.rdf" htmlUrl="http://www.jp.playstation.com/index.html"/>
        </outline>
    </body>
</opml>

Python 2.5 or higher (because Element Tree is included as standard)

xml_edit.py


#coding:utf-8

import xml.etree.ElementTree as ET
#Read xml file
tree = ET.parse('feedly.opml.xml')
root = tree.getroot()

#Category you want to output
category = 'Engineers Blog'
#Search target to throw to findall
find_el = ".//outline[@text='%s']/outline[@type='rss']" % category

es = root.findall(find_el)
for e in es:
    #Dictionary type data can be obtained.
    blog_data = e.attrib
    title = ""
    url = ""
    #Retrieve data.
    for key, value in blog_data.items():
        if key == 'title':
            title = value
        elif key == 'xmlUrl':
            url = value
    print "[%s](%s)"%(title,url)
[hoge](http://hoge/)
[fuga](http://fuga/)

I got it with Markdown, so I posted it on my blog. https://www.karumado.com/2014/05/feedly.html

Recommended Posts

Process feedly xml with Python.
Process Pubmed .xml data with python
Process Pubmed .xml data with python [Part 2]
Generate XML (RSS) with Python
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
python starts with ()
Process multiple lists with for in Python
Bingo with python
Zundokokiyoshi with python
Process big data with Dataflow (ApacheBeam) + Python3
Excel with Python
Microcomputer with Python
Cast with python
Compare xml parsing speeds with Python and Go
Serial communication with Python
Django 1.11 started with Python3.6
Primality test with Python
Python with eclipse + PyDev.
Socket communication with Python
Data analysis with python 2
Scraping with Python (preparation)
Try scraping with Python.
Learning Python with ChemTHEATER 03
"Object-oriented" learning with python
Run Python with VBA
Handling yaml with python
Solve AtCoder 167 with python
Serial communication with python
[Python] Use JSON with Python
Learning Python with ChemTHEATER 05-1
Learn Python with ChemTHEATER
Run prepDE.py with python3
1.1 Getting Started with Python
Collecting tweets with Python
Binarization with OpenCV / Python
3. 3. AI programming with Python
Kernel Method with Python
Non-blocking with Python + uWSGI
Scraping with Python + PhantomJS
Parse XML in Python
Posting tweets with python
Drive WebDriver with python
Use mecab with Python3
[Python] Redirect with CGIHTTPServer
Voice analysis with python
Think yaml with python
Getting Started with Python
Use DynamoDB with Python
Zundko getter with python
Handle Excel with python
Ohm's Law with Python
Primality test with python
Daemonize a Python process
Solve Sudoku with Python