Multiple site routing problems.
elliotgao2 opened this issue · 1 comments
elliotgao2 commented
The example:
from toapi import XPath, Item, Api
api = Api()
class Movie(Item):
__base_url__ = 'http://www.dy2018.com'
url = XPath('//b//a[@class="ulink"]/@href')
title = XPath('//b//a[@class="ulink"]/text()')
class Meta:
source = XPath('//table[@class="tbspan"]')
route = '/'
class Post(Item):
__base_url__ = 'https://news.ycombinator.com/'
url = XPath('//a[@class="storylink"]/@href')
title = XPath('//a[@class="storylink"]/text()')
class Meta:
source = XPath('//tr[@class="athing"]')
route = '/'
api.register(Movie)
api.register(Post)
api.serve()
elliotgao2 commented
When I visite http://127.0.0.1:5000/, it excepted to result in:
{
post:[],
movie:[]
}
When I visit http://127.0.0.1:5000/www.dy2018.com/, it excepted to result in:
{
movie:[]
}
When I visit http://127.0.0.1:5000/news.ycombinator.com/, it excepted to result in:
{
post:[]
}