[twitter] manage profils timelines
This commit is contained in:
parent
67043bea70
commit
7df574fd63
2 changed files with 10 additions and 4 deletions
|
|
@ -20,7 +20,7 @@
|
|||
from weboob.tools.browser2 import LoginBrowser, URL, need_login
|
||||
from weboob.tools.browser import BrowserIncorrectPassword
|
||||
from weboob.capabilities.messages import Message
|
||||
from .pages import LoginPage, LoginErrorPage, ThreadPage, TwitterBasePage, Tweet, TrendsPage, TimelinePage
|
||||
from .pages import LoginPage, LoginErrorPage, ThreadPage, TwitterBasePage, Tweet, TrendsPage, TimelinePage, HomeTimelinePage
|
||||
|
||||
|
||||
__all__ = ['TwitterBrowser']
|
||||
|
|
@ -35,7 +35,7 @@ class TwitterBrowser(LoginBrowser):
|
|||
trends = URL(u'trends', TrendsPage)
|
||||
hashtag = URL(u'hashtag/(?P<path>.+)', TwitterBasePage)
|
||||
search = URL(u'search\?q="(?P<path>.+)"', TwitterBasePage)
|
||||
profil = URL(u'(?P<path>.+)/with_replies', TwitterBasePage)
|
||||
profil = URL(u'i/profiles/show/(?P<path>.+)/timeline', HomeTimelinePage)
|
||||
timeline = URL(u'i/timeline', TimelinePage)
|
||||
login = URL(u'', LoginPage)
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ from weboob.tools.browser2.page import HTMLPage, JsonPage, method, ListElement,
|
|||
from weboob.tools.browser2.filters import CleanText, Format, Link, Regexp, Env, DateTime, Attr, Filter
|
||||
from weboob.capabilities.messages import Thread, Message
|
||||
from weboob.capabilities.base import CapBaseObject
|
||||
__all__ = ['LoginPage', 'LoginErrorPage', 'ThreadPage', 'TwitterBasePage', 'Tweet', 'TrendsPage', 'TimelinePage']
|
||||
__all__ = ['LoginPage', 'LoginErrorPage', 'ThreadPage', 'TwitterBasePage', 'Tweet', 'TrendsPage', 'TimelinePage', 'HomeTimelinePage']
|
||||
|
||||
|
||||
class DatetimeFromTimestamp(Filter):
|
||||
|
|
@ -139,7 +139,7 @@ class TimelinePage(TwitterJsonHTMLPage):
|
|||
|
||||
def next_page(self):
|
||||
if self.page.has_next:
|
||||
return u'https://twitter.com/i/timeline?max_position=%s' % self.get_last_id()
|
||||
return u'%s?max_position=%s' % (self.page.url.split('?')[0], self.get_last_id())
|
||||
|
||||
def get_last_id(self):
|
||||
_el = self.page.doc.xpath('//*[@data-item-type="tweet"]/div')[-1]
|
||||
|
|
@ -157,6 +157,12 @@ class TimelinePage(TwitterJsonHTMLPage):
|
|||
obj_date = DatetimeFromTimestamp(Attr('./div/div[@class="stream-item-header"]/small/a/span|./div/div/span/a[@class="ProfileTweet-timestamp js-permalink js-nav js-tooltip"]/span', 'data-time'))
|
||||
|
||||
|
||||
class HomeTimelinePage(TimelinePage):
|
||||
def next_page(self):
|
||||
if self.page.has_next:
|
||||
return u'%s?max_id=%s' % (self.page.url.split('?')[0], self.get_last_id())
|
||||
|
||||
|
||||
class LoginErrorPage(HTMLPage):
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue