From e6130cab54d99207cc1d66bf33b227d43fa6af02 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Fri, 26 Aug 2011 12:16:34 +0200 Subject: [PATCH] prevent being detected as a robot by a crappy phpbb check --- weboob/backends/phpbb/pages/forum.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/weboob/backends/phpbb/pages/forum.py b/weboob/backends/phpbb/pages/forum.py index f6e952ac..81928a5a 100644 --- a/weboob/backends/phpbb/pages/forum.py +++ b/weboob/backends/phpbb/pages/forum.py @@ -194,6 +194,7 @@ class PostingPage(PhpBBPage): def post(self, title, content): self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'postform') self.browser.set_all_readonly(False) + if title: self.browser['subject'] = title.encode('utf-8') self.browser['message'] = content.encode('utf-8') @@ -207,4 +208,11 @@ class PostingPage(PhpBBPage): # To prevent that shit because weboob is too fast, we simulate # a value of lastclick 10 seconds before. self.browser['lastclick'] = str(int(self.browser['lastclick']) - 10) + + # Likewise for create_time, with this check: + # $diff = time() - $creation_time; + # // If creation_time and the time() now is zero we can assume it was not a human doing this (the check for if ($diff)... + # if ($diff && ($diff <= $timespan || $timespan === -1)) + self.browser['creation_time'] = str(int(self.browser['creation_time']) - 10) + self.browser.submit(name='post')