mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Improve speed of stories parsing
This commit is contained in:
parent
dcdf65ebf3
commit
2bbe5af50b
@ -56,12 +56,15 @@ class GetAllStories:
|
||||
)
|
||||
)
|
||||
|
||||
users = {i.id: i for i in r.users}
|
||||
chats = {i.id: i for i in r.chats}
|
||||
|
||||
for peer_story in r.peer_stories:
|
||||
for story in peer_story.stories:
|
||||
yield await types.Story._parse(
|
||||
self,
|
||||
story,
|
||||
{i.id: i for i in r.users},
|
||||
{i.id: i for i in r.chats},
|
||||
users,
|
||||
chats,
|
||||
peer_story.peer
|
||||
)
|
||||
|
@ -59,11 +59,14 @@ class GetPeerStories:
|
||||
)
|
||||
)
|
||||
|
||||
users = {i.id: i for i in r.users}
|
||||
chats = {i.id: i for i in r.chats}
|
||||
|
||||
for story in r.stories.stories:
|
||||
yield await types.Story._parse(
|
||||
self,
|
||||
story,
|
||||
{i.id: i for i in r.users},
|
||||
{i.id: i for i in r.chats},
|
||||
users,
|
||||
chats,
|
||||
r.stories.peer
|
||||
)
|
||||
|
@ -69,13 +69,16 @@ class GetStories:
|
||||
|
||||
stories = []
|
||||
|
||||
users = {i.id: i for i in r.users}
|
||||
chats = {i.id: i for i in r.chats}
|
||||
|
||||
for story in r.stories:
|
||||
stories.append(
|
||||
await types.Story._parse(
|
||||
self,
|
||||
story,
|
||||
{i.id: i for i in r.users},
|
||||
{i.id: i for i in r.chats},
|
||||
users,
|
||||
chats,
|
||||
peer
|
||||
)
|
||||
)
|
||||
|
@ -77,12 +77,15 @@ class GetStoriesArchive:
|
||||
last = r.stories[-1]
|
||||
offset_id = last.id
|
||||
|
||||
users = {i.id: i for i in r.users}
|
||||
chats = {i.id: i for i in r.chats}
|
||||
|
||||
for story in r.stories:
|
||||
yield await types.Story._parse(
|
||||
self,
|
||||
story,
|
||||
{i.id: i for i in r.users},
|
||||
{i.id: i for i in r.chats},
|
||||
users,
|
||||
chats,
|
||||
peer
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user