diff --git a/instagrapi/auth.py b/instagrapi/auth.py index a299e6db..ae96f246 100644 --- a/instagrapi/auth.py +++ b/instagrapi/auth.py @@ -16,7 +16,7 @@ class PreLoginFlow: def pre_login_flow(self) -> bool: - """Эмуляция работы приложения до логина + """Emulation mobile app behaivor before login """ # /api/v1/accounts/get_prefill_candidates self.get_prefill_candidates(True) @@ -76,9 +76,9 @@ def set_contact_point_prefill(self, usage: str = "prefill") -> dict: return self.private_request("accounts/contact_point_prefill/", data, login=True) -class LoginFlow: +class PostLoginFlow: def login_flow(self) -> bool: - """Эмуляция работы приложения после логина + """Emulation mobile app behaivor after login """ check_flow = [] chance = random.randint(1, 100) % 2 == 0 @@ -145,12 +145,17 @@ def get_reels_tray_feed(self, reason: str = "pull_to_refresh") -> dict: return self.private_request("feed/reels_tray/", data) -class Login(PreLoginFlow, LoginFlow): +class Login(PreLoginFlow, PostLoginFlow): username = None password = None last_login = None relogin_attempt = 0 device_settings = {} + client_session_id = "" + advertising_id = "" + device_id = "" + phone_id = "" + uuid = "" def init(self) -> bool: if "cookies" in self.settings: diff --git a/instagrapi/types.py b/instagrapi/types.py index 14c9b367..bcaae8f8 100644 --- a/instagrapi/types.py +++ b/instagrapi/types.py @@ -5,7 +5,7 @@ class Resource(BaseModel): pk: int - video_url: Optional[HttpUrl] = '' # for Video and IGTV + video_url: Optional[HttpUrl] # for Video and IGTV thumbnail_url: HttpUrl media_type: int @@ -21,7 +21,7 @@ class User(BaseModel): follower_count: int following_count: int biography: Optional[str] = '' - external_url: Optional[HttpUrl] = '' + external_url: Optional[HttpUrl] is_business: bool @@ -29,7 +29,7 @@ class UserShort(BaseModel): pk: int username: str full_name: Optional[str] = '' - profile_pic_url: Optional[HttpUrl] = '' + profile_pic_url: Optional[HttpUrl] # is_private: bool # is_verified: bool @@ -49,7 +49,7 @@ class Location(BaseModel): external_id: Optional[int] external_id_source: Optional[str] # address_json: Optional[dict] = {} - # profile_pic_url: Optional[HttpUrl] = '' + # profile_pic_url: Optional[HttpUrl] # directory: Optional[dict] = {} @@ -60,14 +60,14 @@ class Media(BaseModel): taken_at: datetime media_type: int product_type: Optional[str] = '' # only for IGTV - thumbnail_url: Optional[HttpUrl] = '' + thumbnail_url: Optional[HttpUrl] location: Optional[Location] = None user: UserShort comment_count: int like_count: int caption_text: str usertags: List[Usertag] - video_url: Optional[HttpUrl] = '' # for Video and IGTV + video_url: Optional[HttpUrl] # for Video and IGTV view_count: Optional[int] = 0 # for Video and IGTV video_duration: Optional[float] = 0.0 # for Video and IGTV title: Optional[str] = '' diff --git a/tests.py b/tests.py index 169cb3bb..bc1187ec 100644 --- a/tests.py +++ b/tests.py @@ -464,7 +464,7 @@ def test_extract_media_album(self): else: self.assertEqual(getattr(video_resource, key), val) for key, val in { - "video_url": "", + "video_url": None, "thumbnail_url": "https://", "media_type": 1, "pk": 1787133803186894424,