-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added followers() and followings() to Mobile.py
- Loading branch information
Showing
13 changed files
with
253 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from ensta.structures.Follower import Follower | ||
|
||
|
||
def parse_followers_list(items: list[dict]) -> list[Follower]: | ||
|
||
followers = list() | ||
|
||
for item in items: | ||
|
||
followers.append( | ||
Follower( | ||
user_id=str(item.get("pk")), | ||
username=item.get("username"), | ||
full_name=item.get("full_name"), | ||
is_private=item.get("is_private"), | ||
fbid_v2=item.get("fbid_v2"), | ||
third_party_downloads_enabled=item.get("third_party_downloads_enabled"), | ||
profile_picture_id=item.get("profile_pic_id"), | ||
profile_picture_url=item.get("profile_pic_url"), | ||
is_verified=item.get("is_verified"), | ||
has_anonymous_profile_picture=item.get("has_anonymous_profile_picture"), | ||
latest_reel_media=item.get("latest_reel_media") | ||
) | ||
) | ||
|
||
return followers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from ensta.structures.Followers import Followers | ||
from ensta.structures.Follower import Follower | ||
from .FollowersListParser import parse_followers_list | ||
|
||
|
||
def parse_followers(information: dict) -> Followers: | ||
|
||
followers_list: list[Follower] = parse_followers_list(information.get("users")) | ||
|
||
return Followers( | ||
list=followers_list, | ||
next_cursor=information.get("next_max_id"), | ||
big_list=information.get("big_list"), | ||
list_length=information.get("page_size"), | ||
has_more=information.get("has_more"), | ||
should_limit_list_of_followers=information.get("should_limit_list_of_followers"), | ||
use_clickable_see_more=information.get("use_clickable_see_more"), | ||
show_spam_follow_request_tab=information.get("show_spam_follow_request_tab") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from ensta.structures.Following import Following | ||
|
||
|
||
def parse_followings_list(items: list[dict]) -> list[Following]: | ||
|
||
followings = list() | ||
|
||
for item in items: | ||
|
||
followings.append( | ||
Following( | ||
user_id=str(item.get("pk")), | ||
username=item.get("username"), | ||
full_name=item.get("full_name"), | ||
is_private=item.get("is_private"), | ||
fbid_v2=item.get("fbid_v2"), | ||
third_party_downloads_enabled=item.get("third_party_downloads_enabled"), | ||
profile_picture_id=item.get("profile_pic_id"), | ||
profile_picture_url=item.get("profile_pic_url"), | ||
is_verified=item.get("is_verified"), | ||
has_anonymous_profile_picture=item.get("has_anonymous_profile_picture"), | ||
latest_reel_media=item.get("latest_reel_media"), | ||
is_favorite=item.get("is_favorite") | ||
) | ||
) | ||
|
||
return followings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from ensta.structures.Followings import Followings | ||
from ensta.structures.Following import Following | ||
from .FollowingsListParser import parse_followings_list | ||
|
||
|
||
def parse_followings(information: dict) -> Followings: | ||
|
||
followings_list: list[Following] = parse_followings_list(information.get("users")) | ||
|
||
return Followings( | ||
list=followings_list, | ||
next_cursor=information.get("next_max_id"), | ||
big_list=information.get("big_list"), | ||
list_length=information.get("page_size"), | ||
hashtag_count=information.get("hashtag_count"), | ||
has_more=information.get("has_more"), | ||
should_limit_list_of_followers=information.get("should_limit_list_of_followers"), | ||
use_clickable_see_more=information.get("use_clickable_see_more"), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
from .BiographyLinkParser import parse_biography_link | ||
from .ProfileParser import parse_profile | ||
from .FollowersParser import parse_followers | ||
from .FollowingsParser import parse_followings | ||
from .FollowersListParser import parse_followers_list | ||
from .FollowingsListParser import parse_followings_list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class Follower: | ||
|
||
""" | ||
Stores single follower information e.g. - Full Name, Username, Profile Picture Url, etc. | ||
""" | ||
|
||
user_id: str | ||
username: str | ||
full_name: str | ||
is_private: bool | ||
fbid_v2: str | ||
third_party_downloads_enabled: int | ||
profile_picture_id: str | ||
profile_picture_url: str | ||
is_verified: bool | ||
has_anonymous_profile_picture: bool | ||
latest_reel_media: int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from dataclasses import dataclass | ||
from .Follower import Follower | ||
|
||
|
||
@dataclass | ||
class Followers: | ||
|
||
""" | ||
Stores fetched followers information e.g. - List, Next Cursor, List Length, etc. | ||
""" | ||
|
||
list: list[Follower] | ||
next_cursor: int | ||
big_list: bool | ||
list_length: int | ||
has_more: bool | ||
should_limit_list_of_followers: bool | ||
use_clickable_see_more: bool | ||
show_spam_follow_request_tab: bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class Following: | ||
|
||
""" | ||
Stores single following information e.g. - Full Name, Username, Profile Picture Url, etc. | ||
""" | ||
|
||
user_id: str | ||
username: str | ||
full_name: str | ||
is_private: bool | ||
fbid_v2: str | ||
third_party_downloads_enabled: int | ||
profile_picture_id: str | ||
profile_picture_url: str | ||
is_verified: bool | ||
has_anonymous_profile_picture: bool | ||
latest_reel_media: int | ||
is_favorite: bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from dataclasses import dataclass | ||
from .Following import Following | ||
|
||
|
||
@dataclass | ||
class Followings: | ||
|
||
""" | ||
Stores fetched followings information e.g. - List, Next Cursor, List Length, etc. | ||
""" | ||
|
||
list: list[Following] | ||
next_cursor: int | ||
big_list: bool | ||
list_length: int | ||
hashtag_count: int | ||
has_more: bool | ||
should_limit_list_of_followers: bool | ||
use_clickable_see_more: bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
from .Profile import Profile | ||
from .BiographyLink import BiographyLink | ||
from .StoryLink import StoryLink | ||
from .Followers import Followers | ||
from .Followings import Followings | ||
from .Follower import Follower | ||
from .Following import Following |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters