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 peer_story in r.peer_stories:
|
||||||
for story in peer_story.stories:
|
for story in peer_story.stories:
|
||||||
yield await types.Story._parse(
|
yield await types.Story._parse(
|
||||||
self,
|
self,
|
||||||
story,
|
story,
|
||||||
{i.id: i for i in r.users},
|
users,
|
||||||
{i.id: i for i in r.chats},
|
chats,
|
||||||
peer_story.peer
|
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:
|
for story in r.stories.stories:
|
||||||
yield await types.Story._parse(
|
yield await types.Story._parse(
|
||||||
self,
|
self,
|
||||||
story,
|
story,
|
||||||
{i.id: i for i in r.users},
|
users,
|
||||||
{i.id: i for i in r.chats},
|
chats,
|
||||||
r.stories.peer
|
r.stories.peer
|
||||||
)
|
)
|
||||||
|
@ -69,13 +69,16 @@ class GetStories:
|
|||||||
|
|
||||||
stories = []
|
stories = []
|
||||||
|
|
||||||
|
users = {i.id: i for i in r.users}
|
||||||
|
chats = {i.id: i for i in r.chats}
|
||||||
|
|
||||||
for story in r.stories:
|
for story in r.stories:
|
||||||
stories.append(
|
stories.append(
|
||||||
await types.Story._parse(
|
await types.Story._parse(
|
||||||
self,
|
self,
|
||||||
story,
|
story,
|
||||||
{i.id: i for i in r.users},
|
users,
|
||||||
{i.id: i for i in r.chats},
|
chats,
|
||||||
peer
|
peer
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -77,12 +77,15 @@ class GetStoriesArchive:
|
|||||||
last = r.stories[-1]
|
last = r.stories[-1]
|
||||||
offset_id = last.id
|
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:
|
for story in r.stories:
|
||||||
yield await types.Story._parse(
|
yield await types.Story._parse(
|
||||||
self,
|
self,
|
||||||
story,
|
story,
|
||||||
{i.id: i for i in r.users},
|
users,
|
||||||
{i.id: i for i in r.chats},
|
chats,
|
||||||
peer
|
peer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user