several fixes in the new ICapTranslate capability, module and application
This commit is contained in:
parent
4b05f77329
commit
a8166a4719
5 changed files with 96 additions and 78 deletions
|
|
@ -17,15 +17,17 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from datetime import date
|
||||
|
||||
from weboob.tools.browser import BasePage
|
||||
|
||||
|
||||
__all__ = ['TranslatePage']
|
||||
|
||||
|
||||
class TranslatePage(BasePage):
|
||||
def get_translation(self):
|
||||
for span in self.document.getiterator('span'):
|
||||
if (span.attrib.get('id', '') == 'result_box'):
|
||||
for children in span.getchildren():
|
||||
return children.text
|
||||
|
||||
boxes = self.parser.select(self.document.getroot(), 'span#result_box', 1).findall('span')
|
||||
if len(boxes) == 0:
|
||||
return None
|
||||
|
||||
return u'\n'.join([unicode(box.text) for box in boxes])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue