Commit 49a66530 authored by Bezleputh's avatar Bezleputh

[twitter] fix problem of pagination while using list command without configured user.

The process retrieved all tweets from each account.
The command was then unusable.
parent 079bab97
......@@ -26,7 +26,7 @@ from weboob.capabilities.collection import ICapCollection, CollectionNotFound, C
from weboob.capabilities.base import find_object
from import BrowserForbidden
from .browser import TwitterBrowser
import itertools
__all__ = ['TwitterBackend']
......@@ -66,17 +66,17 @@ class TwitterBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapCollection
tweets = []
if profils:
for profil in profils.split(','):
for tweet in self.browser.get_tweets_from_profil(profil):
for tweet in itertools.islice(self.browser.get_tweets_from_profil(profil), 0, 20):
if hashtags:
for hashtag in hashtags.split(','):
for tweet in self.browser.get_tweets_from_hashtag(hashtag):
for tweet in itertools.islice(self.browser.get_tweets_from_hashtag(hashtag), 0, 20):
if searchs:
for search in searchs.split(','):
for tweet in self.browser.get_tweets_from_search(search):
for tweet in itertools.islice(self.browser.get_tweets_from_search(search), 0 ,20):
tweets.sort(key=lambda o:, reverse=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment