support sondages
This commit is contained in:
parent
e1523608fb
commit
c74bd6e028
3 changed files with 8 additions and 1 deletions
|
|
@ -40,6 +40,7 @@ class DLFP(BaseBrowser):
|
||||||
'https://linuxfr.org/wiki/nouveau': WikiEditPage,
|
'https://linuxfr.org/wiki/nouveau': WikiEditPage,
|
||||||
'https://linuxfr.org/wiki/[^\.]+/modifier': WikiEditPage,
|
'https://linuxfr.org/wiki/[^\.]+/modifier': WikiEditPage,
|
||||||
'https://linuxfr.org/suivi/[^\.]+': ContentPage,
|
'https://linuxfr.org/suivi/[^\.]+': ContentPage,
|
||||||
|
'https://linuxfr.org/sondages/[^\.]+': ContentPage,
|
||||||
'https://linuxfr.org/users/[\w\-_]+/journaux/[^\.]+': ContentPage,
|
'https://linuxfr.org/users/[\w\-_]+/journaux/[^\.]+': ContentPage,
|
||||||
'https://linuxfr.org/forums/[\w\-_]+/posts/[^\.]+': ContentPage,
|
'https://linuxfr.org/forums/[\w\-_]+/posts/[^\.]+': ContentPage,
|
||||||
'https://linuxfr.org/nodes/(\d+)/comments/(\d+)': CommentPage,
|
'https://linuxfr.org/nodes/(\d+)/comments/(\d+)': CommentPage,
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ class ContentPage(DLFPPage):
|
||||||
if not self.article:
|
if not self.article:
|
||||||
self.article = Article(self.browser,
|
self.article = Article(self.browser,
|
||||||
self.url,
|
self.url,
|
||||||
select(self.document.getroot(), 'article', 1))
|
select(self.document.getroot(), 'div#contents article', 1))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
threads = select(self.document.getroot(), 'ul.threads', 1)
|
threads = select(self.document.getroot(), 'ul.threads', 1)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ URL2ID_DIARY_RE = re.compile('.*/users/([\w\-_]+)/journaux/([^\.]+)')
|
||||||
URL2ID_NEWSPAPER_RE = re.compile('.*/news/(.+)')
|
URL2ID_NEWSPAPER_RE = re.compile('.*/news/(.+)')
|
||||||
URL2ID_WIKI_RE = re.compile('.*/wiki/([^ /]+)')
|
URL2ID_WIKI_RE = re.compile('.*/wiki/([^ /]+)')
|
||||||
URL2ID_SUIVI_RE = re.compile('.*/suivi/([^ /]+)')
|
URL2ID_SUIVI_RE = re.compile('.*/suivi/([^ /]+)')
|
||||||
|
URL2ID_SONDAGE_RE = re.compile('.*/sondages/([^ /]+)')
|
||||||
URL2ID_FORUM_RE = re.compile('.*/forums/([\w\-_]+)/posts/([^\.]+)')
|
URL2ID_FORUM_RE = re.compile('.*/forums/([\w\-_]+)/posts/([^\.]+)')
|
||||||
|
|
||||||
def rssid(entry):
|
def rssid(entry):
|
||||||
|
|
@ -57,6 +58,8 @@ def id2url(id):
|
||||||
return '/forums/%s/posts/%s' % (m.group(2), m.group(3))
|
return '/forums/%s/posts/%s' % (m.group(2), m.group(3))
|
||||||
if m.group(1) == 'S':
|
if m.group(1) == 'S':
|
||||||
return '/suivi/%s' % m.group(3)
|
return '/suivi/%s' % m.group(3)
|
||||||
|
if m.group(1) == 's':
|
||||||
|
return '/sondages/%s?results=1' % m.group(3)
|
||||||
|
|
||||||
def url2id(url):
|
def url2id(url):
|
||||||
m = URL2ID_NEWSPAPER_RE.match(url)
|
m = URL2ID_NEWSPAPER_RE.match(url)
|
||||||
|
|
@ -74,6 +77,9 @@ def url2id(url):
|
||||||
m = URL2ID_SUIVI_RE.match(url)
|
m = URL2ID_SUIVI_RE.match(url)
|
||||||
if m:
|
if m:
|
||||||
return 'S.%s' % (m.group(1))
|
return 'S.%s' % (m.group(1))
|
||||||
|
m = URL2ID_SONDAGE_RE.match(url)
|
||||||
|
if m:
|
||||||
|
return 's.%s' % (m.group(1))
|
||||||
|
|
||||||
def id2threadid(id):
|
def id2threadid(id):
|
||||||
m = ID2URL_RE.match(id)
|
m = ID2URL_RE.match(id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue