def create_directory_manager(self): from classes.prepare_directories import DirectoryManager api = self.get_api() base_directory_manager = api.base_directory_manager profile_directory = base_directory_manager.profile.root_directory.joinpath( self.username) metadata_directory = base_directory_manager.root_metadata_directory download_directory = base_directory_manager.root_download_directory self.directory_manager = DirectoryManager( api.get_site_settings(), profile_directory, metadata_directory, download_directory, ) self.file_manager.directory_manager = self.directory_manager return self.directory_manager
def __init__(self, api: api_types, config: Config) -> None: self.api = api self.max_threads = config.settings.max_threads self.config = config self.lists = None self.pool: Pool = api_helper.multiprocessing() global_settings = self.get_global_settings() site_settings = self.get_site_settings() profile_root_directory = main_helper.check_space( global_settings.profile_directories ) root_metadata_directory = main_helper.check_space( site_settings.metadata_directories ) root_download_directory = main_helper.check_space( site_settings.download_directories ) self.base_directory_manager = DirectoryManager( site_settings, profile_root_directory, root_metadata_directory, root_download_directory, )
def __init__( self, option: dict[str, Any], authed: create_auth, ) -> None: from classes.prepare_directories import DirectoryManager, FileManager self.avatar: Any = option.get("avatar") self.avatarThumbs: Any = option.get("avatarThumbs") self.header: Any = option.get("banner") self.headerSize: Any = option.get("headerSize") self.headerThumbs: Any = option.get("headerThumbs") self.id: int = option.get("id") self.name: str = option.get("name") self.username: str = option.get("username") self.canLookStory: bool = option.get("canLookStory") self.canCommentStory: bool = option.get("canCommentStory") self.hasNotViewedStory: bool = option.get("hasNotViewedStory") self.isVerified: bool = option.get("isVerified") self.canPayInternal: bool = option.get("canPayInternal") self.hasScheduledStream: bool = option.get("hasScheduledStream") self.hasStream: bool = option.get("hasStream") self.hasStories: bool = option.get("hasStories") self.tipsEnabled: bool = option.get("tipsEnabled") self.tipsTextEnabled: bool = option.get("tipsTextEnabled") self.tipsMin: int = option.get("tipsMin") self.tipsMax: int = option.get("tipsMax") self.canEarn: bool = option.get("canEarn") self.canAddSubscriber: bool = option.get("canAddSubscriber") self.subscribePrice: int = option.get("subscribePrice") self.hasStripe: bool = option.get("hasStripe") self.isStripeExist: bool = option.get("isStripeExist") self.subscriptionBundles: list[dict[Any, Any]] = option.get( "subscriptionTiers", [] ) self.canSendChatToAll: bool = option.get("canSendChatToAll") self.creditsMin: int = option.get("creditsMin") self.creditsMax: int = option.get("creditsMax") self.isPaywallRestriction: bool = option.get("isPaywallRestriction") self.unprofitable: bool = option.get("unprofitable") self.listsSort: str = option.get("listsSort") self.listsSortOrder: str = option.get("listsSortOrder") self.canCreateLists: bool = option.get("canCreateLists") self.joinDate: str = option.get("joinDate") self.isReferrerAllowed: bool = option.get("isReferrerAllowed") self.about: str = option.get("about") self.rawAbout: str = option.get("rawAbout") self.website: str = option.get("website") self.wishlist: str = option.get("wishlist") self.location: str = option.get("location") timeline_status = option.get("timelineStats", {}) self.postsCount: int = option.get("postsCount") self.archivedPostsCount: int = option.get("archivedPostsCount") self.photosCount: int = timeline_status.get("imageCount") self.videosCount: int = timeline_status.get("videoCount") self.audiosCount: int = option.get("audiosCount") self.mediasCount: int = option.get("mediasCount") self.promotions: list = option.get("promotions") self.lastSeen: Any = option.get("lastSeen") self.favoritesCount: int = option.get("favoritesCount") self.favoritedCount: int = option.get("favoritedCount") self.showPostsInFeed: bool = option.get("showPostsInFeed") self.canReceiveChatMessage: bool = option.get("canReceiveChatMessage") self.isPerformer: bool = option.get("isPerformer") self.isRealPerformer: bool = option.get("isRealPerformer") self.isSpotifyConnected: bool = option.get("isSpotifyConnected") self.subscribersCount: int = option.get("subscribersCount") self.hasPinnedPosts: bool = option.get("hasPinnedPosts") self.canChat: bool = option.get("canChat") self.callPrice: int = option.get("callPrice") self.isPrivateRestriction: bool = option.get("isPrivateRestriction") self.following: bool = option.get("following") self.showSubscribersCount: bool = option.get("showSubscribersCount") self.showMediaCount: bool = option.get("showMediaCount") self.subscribed: bool = option.get("subscribed", False) self.subscribedByData: Any = option.get("subscription") self.subscribedOnData: Any = option.get("subscribedOnData") self.canPromotion: bool = option.get("canPromotion") self.canCreatePromotion: bool = option.get("canCreatePromotion") self.canCreateTrial: bool = option.get("canCreateTrial") self.isAdultContent: bool = option.get("isAdultContent") self.isBlocked: bool = option.get("isBlocked") self.canTrialSend: bool = option.get("canTrialSend") self.canAddPhone: bool = option.get("canAddPhone") self.phoneLast4: Any = option.get("phoneLast4") self.phoneMask: Any = option.get("phoneMask") self.hasNewTicketReplies: dict = option.get("hasNewTicketReplies") self.hasInternalPayments: bool = option.get("hasInternalPayments") self.isCreditsEnabled: bool = option.get("isCreditsEnabled") self.creditBalance: float = option.get("creditBalance") self.isMakePayment: bool = option.get("isMakePayment") self.isOtpEnabled: bool = option.get("isOtpEnabled") self.email: str = option.get("email") self.isEmailChecked: bool = option.get("isEmailChecked") self.isLegalApprovedAllowed: bool = option.get("isLegalApprovedAllowed") self.isTwitterConnected: bool = option.get("isTwitterConnected") self.twitterUsername: Any = option.get("twitterUsername") self.isAllowTweets: bool = option.get("isAllowTweets") self.isPaymentCardConnected: bool = option.get("isPaymentCardConnected") self.referalUrl: str = option.get("referalUrl") self.isVisibleOnline: bool = option.get("isVisibleOnline") self.subscribesCount: int = option.get("subscribesCount") self.canPinPost: bool = option.get("canPinPost") self.hasNewAlerts: bool = option.get("hasNewAlerts") self.hasNewHints: bool = option.get("hasNewHints") self.hasNewChangedPriceSubscriptions: bool = option.get( "hasNewChangedPriceSubscriptions" ) self.notificationsCount: int = option.get("notificationsCount") self.chatMessagesCount: int = option.get("chatMessagesCount") self.isWantComments: bool = option.get("isWantComments") self.watermarkText: str = option.get("watermarkText") self.customWatermarkText: Any = option.get("customWatermarkText") self.hasWatermarkPhoto: bool = option.get("hasWatermarkPhoto") self.hasWatermarkVideo: bool = option.get("hasWatermarkVideo") self.canDelete: bool = option.get("canDelete") self.isTelegramConnected: bool = option.get("isTelegramConnected") self.advBlock: list = option.get("advBlock") self.hasPurchasedPosts: bool = option.get("hasPurchasedPosts") self.isEmailRequired: bool = option.get("isEmailRequired") self.isPayoutLegalApproved: bool = option.get("isPayoutLegalApproved") self.payoutLegalApproveState: str = option.get("payoutLegalApproveState") self.payoutLegalApproveRejectReason: Any = option.get( "payoutLegalApproveRejectReason" ) self.enabledImageEditorForChat: bool = option.get("enabledImageEditorForChat") self.shouldReceiveLessNotifications: bool = option.get( "shouldReceiveLessNotifications" ) self.canCalling: bool = option.get("canCalling") self.paidFeed: bool = option.get("paidFeed") self.canSendSms: bool = option.get("canSendSms") self.canAddFriends: bool = option.get("canAddFriends") self.isRealCardConnected: bool = option.get("isRealCardConnected") self.countPriorityChat: int = option.get("countPriorityChat") self.hasScenario: bool = option.get("hasScenario") self.isWalletAutorecharge: bool = option.get("isWalletAutorecharge") self.walletAutorechargeAmount: int = option.get("walletAutorechargeAmount") self.walletAutorechargeMin: int = option.get("walletAutorechargeMin") self.walletFirstRebills: bool = option.get("walletFirstRebills") self.closeFriends: int = option.get("closeFriends") self.canAlternativeWalletTopUp: bool = option.get("canAlternativeWalletTopUp") self.needIVApprove: bool = option.get("needIVApprove") self.ivStatus: Any = option.get("ivStatus") self.ivFailReason: Any = option.get("ivFailReason") self.canCheckDocsOnAddCard: bool = option.get("canCheckDocsOnAddCard") self.faceIdAvailable: bool = option.get("faceIdAvailable") self.ivCountry: Any = option.get("ivCountry") self.ivForcedVerified: bool = option.get("ivForcedVerified") self.ivFlow: str = option.get("ivFlow") self.isVerifiedReason: bool = option.get("isVerifiedReason") self.canReceiveManualPayout: bool = option.get("canReceiveManualPayout") self.canReceiveStripePayout: bool = option.get("canReceiveStripePayout") self.manualPayoutPendingDays: int = option.get("manualPayoutPendingDays") self.isNeedConfirmPayout: bool = option.get("isNeedConfirmPayout") self.canStreaming: bool = option.get("canStreaming") self.isScheduledStreamsAllowed: bool = option.get("isScheduledStreamsAllowed") self.canMakeExpirePosts: bool = option.get("canMakeExpirePosts") self.trialMaxDays: int = option.get("trialMaxDays") self.trialMaxExpiresDays: int = option.get("trialMaxExpiresDays") self.messageMinPrice: int = option.get("messageMinPrice") self.messageMaxPrice: int = option.get("messageMaxPrice") self.postMinPrice: int = option.get("postMinPrice") self.postMaxPrice: int = option.get("postMaxPrice") self.streamMinPrice: int = option.get("streamMinPrice") self.streamMaxPrice: int = option.get("streamMaxPrice") self.canCreatePaidStream: bool = option.get("canCreatePaidStream") self.callMinPrice: int = option.get("callMinPrice") self.callMaxPrice: int = option.get("callMaxPrice") self.subscribeMinPrice: float = option.get("subscribeMinPrice") self.subscribeMaxPrice: int = option.get("subscribeMaxPrice") self.bundleMaxPrice: int = option.get("bundleMaxPrice") self.unclaimedOffersCount: int = option.get("unclaimedOffersCount") self.claimedOffersCount: int = option.get("claimedOffersCount") self.withdrawalPeriod: str = option.get("withdrawalPeriod") self.canAddStory: bool = option.get("canAddStory") self.canAddSubscriberByBundle: bool = option.get("canAddSubscriberByBundle") self.isSuggestionsOptOut: bool = option.get("isSuggestionsOptOut") self.canCreateFundRaising: bool = option.get("canCreateFundRaising") self.minFundRaisingTarget: int = option.get("minFundRaisingTarget") self.maxFundRaisingTarget: int = option.get("maxFundRaisingTarget") self.disputesRatio: int = option.get("disputesRatio") self.vaultListsSort: str = option.get("vaultListsSort") self.vaultListsSortOrder: str = option.get("vaultListsSortOrder") self.canCreateVaultLists: bool = option.get("canCreateVaultLists") self.canMakeProfileLinks: bool = option.get("canMakeProfileLinks") self.replyOnSubscribe: bool = option.get("replyOnSubscribe") self.payoutType: str = option.get("payoutType") self.minPayoutSumm: int = option.get("minPayoutSumm") self.canHasW9Form: bool = option.get("canHasW9Form") self.isVatRequired: bool = option.get("isVatRequired") self.isCountryVatRefundable: bool = option.get("isCountryVatRefundable") self.isCountryVatNumberCollect: bool = option.get("isCountryVatNumberCollect") self.vatNumberName: str = option.get("vatNumberName") self.isCountryWithVat: bool = option.get("isCountryWithVat") self.connectedOfAccounts: list = option.get("connectedOfAccounts") self.hasPassword: bool = option.get("hasPassword") self.canConnectOfAccount: bool = option.get("canConnectOfAccount") self.pinnedPostsCount: int = option.get("pinnedPostsCount") self.maxPinnedPostsCount: int = option.get("maxPinnedPostsCount") # Custom self.__authed = authed self.directory_manager: DirectoryManager = DirectoryManager( authed.api.get_site_settings() ) self.file_manager: FileManager = FileManager(self.directory_manager) self.scraped = content_types() self.temp_scraped = content_types() self.download_info: dict[str, Any] = {} self.duplicate_media = [] self.__raw__ = option if self.subscriptionBundles: self.subscribePrice = self.subscriptionBundles[0]["plans"][0]["price"] if self.avatar: media_options = self.avatar["locations"] self.avatar = media_options[0]["location"] if self.header: media_options = self.header["locations"] self.header = media_options[0]["location"]