Exemplo n.º 1
0
Arquivo: item.py Projeto: mjhea0/grab
    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))))
Exemplo n.º 2
0
    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))))
Exemplo n.º 3
0
    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))))
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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