def test_get_function(self): func = Player.get_function('height1') html = '<html><body><height>3' self.assertEquals(3, func(XpathSelector(parse_html(html)))) func = Player.get_function('height2') html = '<html><body><height>3' self.assertEquals(3, func(XpathSelector(parse_html(html))))
def test_get_function(self): func = Player.get_function('height1') html = '<html><body><height>3' self.assertEquals(3, func(XpathSelector(parse_html(html)))) func = Player.get_function('height2') html = '<html><body><height>3' self.assertEquals(3, func(XpathSelector(parse_html(html))))
def test_get_function(self): func = Player.get_function("height1") html = "<html><body><height>3" self.assertEquals(3, func(XpathSelector(parse_html(html)))) func = Player.get_function("height2") html = "<html><body><height>3" self.assertEquals(3, func(XpathSelector(parse_html(html))))
def parse_projects(self, grab): res = [] for elem in grab.doc('//item'): desc_node = parse_html(elem.select('description').text()) res.append({ 'title': decode_entities(elem.select('title').text()), 'description': self.parse_project_description(desc_node), 'date': self.parse_date(elem.select('pubDate').text()), 'category': self.parse_category(desc_node), 'country': self.parse_country(desc_node), 'id': 'odesk-%s' % self.parse_id(desc_node), 'url': elem.select('link').text(), }) return res
def parse_projects(self, grab): res = [] for elem in grab.doc("//item"): desc_node = parse_html(elem.select("description").text()) res.append( { "title": decode_entities(elem.select("title").text()).replace(u" | Elance Job", u""), "description": self.parse_project_description(desc_node), "date": self.parse_date(elem.select("pubDate").text()), "category": self.parse_category(desc_node), "country": self.parse_country(desc_node), "id": "elance-%s" % self.parse_id(desc_node), "url": elem.select("link").text(), } ) return res