ok i’m gettings somewhere, mostly thanks to you guys!
i managed to write the search function all by my self and it’s working
(hear that, jonny?
)
however, one little question.
first here’s the code:
# Search and extract tag based results<br />
def Search(sender, query):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
pageUrl = SEARCH_URL % query<br />
content1=XML.ElementFromURL(pageUrl, isHTML="True")<br />
Log(pageUrl)<br />
for item in content1.xpath('//link[@type="application/rss+xml"]'): <br />
rssfeed=item.get('href') <br />
Log("rssfeed")<br />
content = XML.ElementFromURL(rssfeed, isHTML="False") <br />
for item in content.xpath('//item'):<br />
title = item.xpath('.//title', namespaces=NAMESPACES)[0].text<br />
Log(title)<br />
thumb = item.xpath('./content', namespaces=NAMESPACES)[0].get('url')<br />
dir.Append(PhotoItem(thumb, title=title, thumb=thumb))<br />
return dir<br />
SEARCH_URL = "http://browse.deviantart.com/?qh=§ion=&q=%s"
… so far search works perfectly, however, it only searches using the first word entered as a search query.
for example the search term: 'large tree' will only be searched as 'large'
search url example in this case from the log:
http://browse.deviantart.com/?qh=§ion=&q=large tree instead of http://browse.deviantart.com/?qh=§ion=&q=large+tree
EDIT: fixed this by adding: (String.Quote(query, usePlus=True))
