Exemplo n.º 1
0
 def __init__(
     self,
     option: dict[str, Any] = {},
     pool: Pool = None,
     max_threads: int = -1,
 ) -> None:
     create_user.__init__(self, option)
     if not self.username:
         self.username = f"u{self.id}"
     self.lists = {}
     self.links = content_types()
     self.subscriptions: list[create_user] = []
     self.chats = None
     self.archived_stories = {}
     self.mass_messages = []
     self.paid_content = []
     temp_pool = pool if pool else api_helper.multiprocessing()
     self.pool = temp_pool
     self.session_manager = api_helper.session_manager(
         self, max_threads=max_threads)
     self.auth_details: auth_details = auth_details()
     self.profile_directory = option.get("profile_directory", "")
     self.guest = False
     self.active: bool = False
     self.errors: list[error_details] = []
     self.extras: dict[str, Any] = {}
Exemplo n.º 2
0
 def __init__(
     self,
     session_manager2: session_manager,
     option={},
     init=False,
     pool=None,
 ) -> None:
     self.id = option.get("id")
     self.username: str = option.get("username")
     if not self.username:
         self.username = f"u{self.id}"
     self.name = option.get("name")
     self.email: str = option.get("email")
     self.lists = {}
     self.links = content_types()
     self.isPerformer: bool = option.get("isPerformer")
     self.chatMessagesCount = option.get("chatMessagesCount")
     self.subscribesCount = option.get("subscribesCount")
     self.subscriptions: list[create_user] = []
     self.chats = None
     self.archived_stories = {}
     self.mass_messages = []
     self.paid_content = []
     session_manager2 = copy.copy(session_manager2)
     self.session_manager = session_manager2
     self.pool = pool
     self.auth_details: Optional[auth_details] = None
     self.profile_directory = option.get("profile_directory", "")
     self.guest = False
     self.active = False
     self.errors: list[error_details] = []
     self.extras = {}
Exemplo n.º 3
0
 def __init__(
     self,
     option: dict[str, Any] = {},
     user: create_user = create_user(),
     pool: Optional[Pool] = None,
     max_threads: int = -1,
 ) -> None:
     self.id = user.id
     self.username = user.username
     if not self.username:
         self.username = f"u{self.id}"
     self.name = user.name
     self.email = user.email
     self.isPerformer = user.isPerformer
     self.chatMessagesCount = user.chatMessagesCount
     self.subscribesCount = user.subscribesCount
     self.lists = {}
     self.links = content_types()
     self.subscriptions: list[create_user] = []
     self.chats = None
     self.archived_stories = {}
     self.mass_messages = []
     self.paid_content = []
     self.pool = pool
     self.session_manager = api_helper.session_manager(self, max_threads=max_threads)
     self.auth_details: Optional[auth_details] = None
     self.cookies: Dict[str, Any] = {}
     self.profile_directory = option.get("profile_directory", "")
     self.guest = False
     self.active: bool = False
     self.errors: list[error_details] = []
     self.extras: Dict[str, Any] = {}
Exemplo n.º 4
0
async def fix_sqlite(
    profile_directory,
    download_directory,
    metadata_directory,
    format_directories,
    authed: create_auth,
    site_name,
    username,
    metadata_directory_format,
):
    items = content_types().__dict__.items()
    final_metadatas = []
    for api_type, value in items:
        mandatory_directories = {}
        mandatory_directories["profile_directory"] = profile_directory
        mandatory_directories["download_directory"] = download_directory
        mandatory_directories["metadata_directory"] = metadata_directory
        formatted_directories = await format_directories(
            mandatory_directories,
            authed,
            site_name,
            username,
            metadata_directory_format,
            "",
            api_type,
        )
        final_metadata_directory = formatted_directories["metadata_directory"]
        if all(final_metadata_directory != x for x in final_metadatas):
            final_metadatas.append(final_metadata_directory)
        print
    print
    for final_metadata in final_metadatas:
        archived_database_path = os.path.join(final_metadata, "Archived.db")
        if os.path.exists(archived_database_path):
            Session2, engine = db_helper.create_database_session(
                archived_database_path)
            database_session: Session = Session2()
            cwd = os.getcwd()
            for api_type, value in items:
                database_path = os.path.join(final_metadata, f"{api_type}.db")
                database_name = api_type.lower()
                alembic_location = os.path.join(cwd, "database",
                                                "archived_databases",
                                                database_name)
                result = inspect(engine).has_table(database_name)
                if result:
                    db_helper.run_migrations(alembic_location,
                                             archived_database_path)
                    db_helper.run_migrations(alembic_location, database_path)
                    Session3, engine2 = db_helper.create_database_session(
                        database_path)
                    db_collection = db_helper.database_collection()
                    database_session2: Session = Session3()
                    database = db_collection.database_picker("user_data")
                    if not database:
                        return
                    table_name = database.table_picker(api_type, True)
                    if not table_name:
                        return
                    archived_result = database_session.query(table_name).all()
                    for item in archived_result:
                        result2 = (database_session2.query(table_name).filter(
                            table_name.post_id == item.post_id).first())
                        if not result2:
                            item2 = item.__dict__
                            item2.pop("id")
                            item2.pop("_sa_instance_state")
                            item = table_name(**item2)
                            item.archived = True
                            database_session2.add(item)
                    database_session2.commit()
                    database_session2.close()
            database_session.commit()
            database_session.close()
            os.remove(archived_database_path)
Exemplo n.º 5
0
 def __init__(self, option={}, subscriber: create_auth = None) -> None:
     self.view: str = option.get("view")
     self.avatar: Any = option.get("avatar")
     self.avatarThumbs: Any = option.get("avatarThumbs")
     self.header: Any = option.get("header")
     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 = option.get("subscriptionBundles")
     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")
     self.postsCount: int = option.get("postsCount")
     self.archivedPostsCount: int = option.get("archivedPostsCount")
     self.photosCount: int = option.get("photosCount")
     self.videosCount: int = option.get("videosCount")
     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.showSubscribersCount: bool = option.get("showSubscribersCount")
     self.showMediaCount: bool = option.get("showMediaCount")
     self.subscribedByData: Any = option.get("subscribedByData")
     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.subscriber = subscriber
     self.scraped = content_types()
     self.temp_scraped = content_types()
     self.session_manager = None
     if subscriber:
         self.session_manager = subscriber.session_manager
     self.download_info = {}
     self.__raw__ = option