Possible Duplicate:
Scrapy Modify Link to include Domain Name
I use this code to extract data from html website and i stored the data in XML file and it works great with me.
def parse(self, response):
hxs = HtmlXPathSelector(response)
items = []
site1 = hxs.select('/html/body/div/div[4]/div[3]/div/div/div[2]/div/ul/li')
for site in site1:
item = NewsItem()
item ['title'] = site.select('a[2]/text()').extract()
item ['image'] = site.select('a/img/@src').extract()
item ['text'] = site.select('p/text()').extract()
item ['link'] = site.select('a[2]/@href').extract()
items.append(item)
return items
but the issue that i am facing is the website provide a short link for ['image'] which like this:
<img src="/a/small/72/72089be43654dc6d7215ec49f4be5a07_w200_h180.jpg"
while the full link should be like this:
<img src="http://www.aleqt.com/a/small/72/72089be43654dc6d7215ec49f4be5a07_w200_h180.jpg"
I want to know how to modify my code to add the missing link automatically