Replace relative link to complete link
This commit is contained in:
parent
02d5fb4c15
commit
c9aadbfb34
1 changed files with 9 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
"ArticlePage object for inrocks"
|
"ArticlePage object for ecrans"
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright(C) 2011 Julien Hebert
|
# Copyright(C) 2011 Julien Hebert
|
||||||
|
|
@ -22,7 +22,7 @@ from weboob.tools.capabilities.messages.genericArticle import GenericNewsPage, r
|
||||||
|
|
||||||
|
|
||||||
class ArticlePage(GenericNewsPage):
|
class ArticlePage(GenericNewsPage):
|
||||||
"ArticlePage object for inrocks"
|
"ArticlePage object for ecrans"
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
self.main_div = self.document.getroot()
|
self.main_div = self.document.getroot()
|
||||||
self.element_title_selector = "title"
|
self.element_title_selector = "title"
|
||||||
|
|
@ -34,5 +34,12 @@ class ArticlePage(GenericNewsPage):
|
||||||
remove_from_selector_list(self.parser, element_body, ["p.auteur", "h4"])
|
remove_from_selector_list(self.parser, element_body, ["p.auteur", "h4"])
|
||||||
try_remove_from_selector_list(self.parser, element_body, ["p.tag", "div.alire", self.element_title_selector, "h4"])
|
try_remove_from_selector_list(self.parser, element_body, ["p.tag", "div.alire", self.element_title_selector, "h4"])
|
||||||
try_drop_tree(self.parser, element_body, "script")
|
try_drop_tree(self.parser, element_body, "script")
|
||||||
|
for a in element_body.findall('.//a'):
|
||||||
|
if a.attrib["href"][0:7] != "http://":
|
||||||
|
a.attrib["href"] = "http://ecrans.fr/" + a.attrib["href"]
|
||||||
|
for img in element_body.xpath('.//img'):
|
||||||
|
if img.attrib["src"][0:7] != "http://":
|
||||||
|
img.attrib["src"] = "http://ecrans.fr/" + img.attrib["src"]
|
||||||
|
|
||||||
|
|
||||||
return self.parser.tostring(element_body)
|
return self.parser.tostring(element_body)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue