My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
26
27
28
29
30
31
32
33
import yql
y = yql.Public()

monitorURL = "http://www.seomoz.org"
rssURL = "http://www.google.com/alerts/feeds/02091889458087148316/10137124638087203861"

rssQuery = "select * from feed where url='%s'" % rssURL;
rssResult = y.execute(rssQuery)

print 'Content-Type: text/plain'
print ''

def findLink(url):
htmlQuery = "select * from html where url='%s' and xpath=@xpath" % link;
htmlResult = y.execute(htmlQuery, {"xpath": "//a[starts-with(@href,'%s')]" % monitorURL})
numLinks = htmlResult.count
if numLinks == 0:
print "No links: %s" % url
else:
print "links: %s" % url

maxLinks = 10;
numLinks = 0;
if rssResult.count > 1:
for row in rssResult.rows:
link = row.get('link').get('href')
findLink(link)
numLinks = numLinks + 1
if numLinks >= maxLinks:
break
else:
link = rssResult.rows.get('link').get('href')
findLink(link)

Change log

r4 by w.critchlow on Apr 16, 2010   Diff
[No log message]
Go to: 
Project members, sign in to write a code review

Older revisions

r3 by w.critchlow on Apr 16, 2010   Diff
[No log message]
r2 by w.critchlow on Apr 15, 2010   Diff
First proof of concept
All revisions of this file

File info

Size: 880 bytes, 33 lines
Powered by Google Project Hosting