-
Notifications
You must be signed in to change notification settings - Fork 37
/
findyyets.py
25 lines (20 loc) · 888 Bytes
/
findyyets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
__author__ = 'Sagacity'
import urllib2
import xml.dom.minidom
theQuery = u"{query}"
# theQuery = u"all"
theQuery = theQuery.strip()
rssurl = 'http://www.yyets.com/rss/feed/'
urldoc = xml.dom.minidom.parse( urllib2.urlopen( rssurl ) )
print "<?xml version=\"1.0\"?>\n<items>"
for item in urldoc.getElementsByTagName('item'):
title = item.getElementsByTagName('title')[0].firstChild.data.replace( "&", "#" )
link = item.getElementsByTagName('link')[0].firstChild.data
if title.__contains__(theQuery) or theQuery == "all":
print " <item uid=\"YYeTs\" arg=\""+ link +"\">"
print " <title>" + title.encode('utf-8') + "</title>"
print " <subtitle>" + title.encode('utf-8') + "</subtitle>"
print ''' <icon type="fileicon">/Applications/QuickTime Player.app/</icon>
</item>'''
print "</items>\n"