diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py new file mode 100644 index 0000000..30475e8 --- /dev/null +++ b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py @@ -0,0 +1,388 @@ +import asyncio +import json +import os +from datetime import timedelta +from nostr_sdk import Client, Timestamp, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, NostrDatabase, \ + ClientBuilder, Filter, NegentropyOptions, NegentropyDirection, init_logger, LogLevel, Event, EventId, Kind, \ + RelayOptions + +from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv +from nostr_dvm.utils import definitions +from nostr_dvm.utils.admin_utils import AdminConfig +from nostr_dvm.utils.definitions import EventDefinitions +from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config +from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88 +from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag, create_amount_tag +from nostr_dvm.utils.output_utils import post_process_list_to_events + +""" +This File contains a Module to discover popular notes +Accepted Inputs: none +Outputs: A list of events +Params: None +""" + + +class DicoverContentCurrentlyPopularMostr(DVMTaskInterface): + KIND: Kind = EventDefinitions.KIND_NIP90_CONTENT_DISCOVERY + TASK: str = "discover-content" + FIX_COST: float = 0 + dvm_config: DVMConfig + request_form = None + last_schedule: int + db_since = 3600 + db_name = "db/nostr_recent_mostr.db" + min_reactions = 1 + personalized = False + result = "" + + async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None, + admin_config: AdminConfig = None, options=None): + + dvm_config.SCRIPT = os.path.abspath(__file__) + self.request_form = {"jobID": "generic"} + opts = { + "max_results": 200, + } + self.request_form['options'] = json.dumps(opts) + + self.last_schedule = Timestamp.now().as_secs() + + if self.options.get("db_name"): + self.db_name = self.options.get("db_name") + if self.options.get("db_since"): + self.db_since = int(self.options.get("db_since")) + + use_logger = False + if use_logger: + init_logger(LogLevel.DEBUG) + + if self.dvm_config.UPDATE_DATABASE: + await self.sync_db() + if not self.personalized: + self.result = await self.calculate_result(self.request_form) + + async def is_input_supported(self, tags, client=None, dvm_config=None): + for tag in tags: + if tag.as_vec()[0] == 'i': + input_value = tag.as_vec()[1] + input_type = tag.as_vec()[2] + if input_type != "text": + return False + return True + + async def create_request_from_nostr_event(self, event, client=None, dvm_config=None): + self.dvm_config = dvm_config + + request_form = {"jobID": event.id().to_hex()} + + # default values + search = "" + max_results = 200 + + for tag in event.tags(): + if tag.as_vec()[0] == 'i': + input_type = tag.as_vec()[2] + elif tag.as_vec()[0] == 'param': + param = tag.as_vec()[1] + if param == "max_results": # check for param type + max_results = int(tag.as_vec()[2]) + + options = { + "max_results": max_results, + } + request_form['options'] = json.dumps(options) + return request_form + + async def process(self, request_form): + # if the dvm supports individual results, recalculate it every time for the request + if self.personalized: + return await self.calculate_result(request_form) + # else return the result that gets updated once every schenduled update. In this case on database update. + else: + return self.result + + async def calculate_result(self, request_form): + from nostr_sdk import Filter + from types import SimpleNamespace + + ns = SimpleNamespace() + options = self.set_options(request_form) + + opts = ( + Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT))) + sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) + keys = Keys.parse(sk.to_hex()) + signer = NostrSigner.keys(keys) + database = await NostrDatabase.sqlite(self.db_name) + cli = ClientBuilder().signer(signer).database(database).opts(opts).build() + + timestamp_since = Timestamp.now().as_secs() - self.db_since + since = Timestamp.from_secs(timestamp_since) + + filter1 = Filter().kind(definitions.EventDefinitions.KIND_NOTE).since(since) + + events = await database.query([filter1]) + if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + ns.finallist = {} + profilestorequest = [] + #for event in events: + # filt = Filter().kinds([EventDefinitions.KIND_PROFILE]).pubkey(event.author()) + # profiles = await database.query([filt]) + # # If the event is not in the DB, fetch it. I will be in the DB afterwards + # if len(profiles) == 0 and event.author() not in profilestorequest: + # profilestorequest.append(event.author()) + + + #if len(profilestorequest) > 0: + # print("requesting " + str(len(profilestorequest)) + " profiles") + # + # for relay in self.dvm_config.RECONCILE_DB_RELAY_LIST: + # await cli.add_relay(relay) + # + # + # await cli.connect() + # + # + # chunks = [profilestorequest[x:x + 200] for x in range(0, len(profilestorequest), 200)] + # index = 1 + # for entry in chunks: + # print("Iteration " + str(index)) + # index += 1 + # filt = Filter().kinds([EventDefinitions.KIND_PROFILE]).authors(entry) + # evts = await cli.get_events_of([filt], None) + # if len(evts) > 0: + # print(len(evts)) + # else: + # print("Couldn't find profiles") + + + for event in events: + + #filt = Filter().kinds([EventDefinitions.KIND_PROFILE]).author(event.author()) + #profiles = await cli.database().query([filt]) + # If the event is not in the DB, fetch it. I will be in the DB afterwards + #if len(profiles) == 0: + # print("No profile found") + # continue + #else: + # profile: Event = profiles[0] + + #if "@mostr.pub" in profile.content() or "@momostr.pink" in profile.content(): + if event.created_at().as_secs() > timestamp_since: + filt = Filter().kinds( + [EventDefinitions.KIND_ZAP, EventDefinitions.KIND_REPOST, + EventDefinitions.KIND_REACTION, + EventDefinitions.KIND_NOTE]).event(event.id()).since(since) + reactions = await database.query([filt]) + + if len(reactions) >= self.min_reactions: + ns.finallist[event.id().to_hex()] = len(reactions) + if len(ns.finallist) == 0: + return self.result + + result_list = [] + finallist_sorted = sorted(ns.finallist.items(), key=lambda x: x[1], reverse=True)[:int(options["max_results"])] + for entry in finallist_sorted: + # print(EventId.parse(entry[0]).to_bech32() + "/" + EventId.parse(entry[0]).to_hex() + ": " + str(entry[1])) + e_tag = Tag.parse(["e", entry[0]]) + result_list.append(e_tag.as_vec()) + if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: + print("[" + self.dvm_config.NIP89.NAME + "] Filtered " + str( + len(result_list)) + " fitting events.") + # await cli.shutdown() + return json.dumps(result_list) + + async def post_process(self, result, event): + """Overwrite the interface function to return a social client readable format, if requested""" + for tag in event.tags(): + if tag.as_vec()[0] == 'output': + format = tag.as_vec()[1] + if format == "text/plain": # check for output type + result = post_process_list_to_events(result) + + # if not text/plain, don't post-process + return result + + async def schedule(self, dvm_config): + if dvm_config.SCHEDULE_UPDATES_SECONDS == 0: + return 0 + else: + if Timestamp.now().as_secs() >= self.last_schedule + dvm_config.SCHEDULE_UPDATES_SECONDS: + if self.dvm_config.UPDATE_DATABASE: + await self.sync_db() + self.last_schedule = Timestamp.now().as_secs() + self.result = await self.calculate_result(self.request_form) + return 1 + else: + return 0 + + async def sync_db(self): + opts = (Options().wait_for_send(False).send_timeout(timedelta(seconds=self.dvm_config.RELAY_LONG_TIMEOUT))) + sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) + keys = Keys.parse(sk.to_hex()) + signer = NostrSigner.keys(keys) + database = await NostrDatabase.sqlite(self.db_name) + cli = ClientBuilder().signer(signer).database(database).opts(opts).build() + + for relay in self.dvm_config.RECONCILE_DB_RELAY_LIST: + await cli.add_relay(relay) + + await cli.connect() + + timestamp_since = Timestamp.now().as_secs() - self.db_since + since = Timestamp.from_secs(timestamp_since) + + filter1 = Filter().kinds( + [definitions.EventDefinitions.KIND_NOTE, EventDefinitions.KIND_PROFILE, EventDefinitions.KIND_ZAP, + EventDefinitions.KIND_REPOST, + EventDefinitions.KIND_REACTION]).since(since) # Notes, reactions, zaps + filter2 = Filter().kinds( + [EventDefinitions.KIND_PROFILE]).limit(10000) # Notes, reactions, zaps + filter3 = Filter().kinds( + [EventDefinitions.KIND_ZAP, + EventDefinitions.KIND_REPOST, + EventDefinitions.KIND_REACTION]).since(since) # Notes, reactions, zaps + # Notes, reactions, zaps + + # filter = Filter().author(keys.public_key()) + if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: + print("[" + self.dvm_config.NIP89.NAME + "] Syncing notes of the last " + str( + self.db_since) + " seconds.. this might take a while..") + #dbopts = NegentropyOptions().direction(NegentropyDirection.DOWN) + #await cli.reconcile(filter1, dbopts) + #await cli.reconcile(filter2, dbopts) + #await cli.reconcile(filter3, dbopts) + + # RECONCOILE NOT POSSIBLE ON THESE RELAYS SO WE FETCH AB BUNCH (will be stored in db) + events = await cli.get_events_of([filter1, filter2, filter3], None) + + # Do not delete profiles + await cli.database().delete(Filter().kinds([EventDefinitions.KIND_NOTE, EventDefinitions.KIND_ZAP, EventDefinitions.KIND_REPOST, EventDefinitions.KIND_REACTION]).until(Timestamp.from_secs( + Timestamp.now().as_secs() - self.db_since))) # Clear old events so db doesn't get too full. + await cli.shutdown() + if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: + print( + "[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str( + self.db_since) + " seconds..") + + +# We build an example here that we can call by either calling this file directly from the main directory, +# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the +# playground or elsewhere +def build_example(name, identifier, admin_config, options, cost=0, update_rate=180, processing_msg=None, + update_db=True): + dvm_config = build_default_config(identifier) + dvm_config.USE_OWN_VENV = False + dvm_config.SHOWLOG = True + dvm_config.SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes + dvm_config.UPDATE_DATABASE = update_db + dvm_config.RECONCILE_DB_RELAY_LIST = ["wss://relay.momostr.pink", "wss://relay.mostr.pub/"] + # Activate these to use a subscription based model instead + # dvm_config.SUBSCRIPTION_REQUIRED = True + # dvm_config.SUBSCRIPTION_DAILY_COST = 1 + dvm_config.FIX_COST = cost + dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg + admin_config.LUD16 = dvm_config.LN_ADDRESS + + image = "https://image.nostr.build/b29b6ec4bf9b6184f69d33cb44862db0d90a2dd9a506532e7ba5698af7d36210.jpg", + + # Add NIP89 + nip89info = { + "name": name, + "image": image, + "picture": image, + "about": "I show notes that are currently popular", + "lud16": dvm_config.LN_ADDRESS, + "encryptionSupported": True, + "cashuAccepted": True, + "personalized": False, + "amount": create_amount_tag(cost), + "nip90Params": { + "max_results": { + "required": False, + "values": [], + "description": "The number of maximum results to return (default currently 100)" + } + } + } + + nip89config = NIP89Config() + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.CONTENT = json.dumps(nip89info) + + # admin_config.UPDATE_PROFILE = False + # admin_config.REBROADCAST_NIP89 = False + + return DicoverContentCurrentlyPopularMostr(name=name, dvm_config=dvm_config, nip89config=nip89config, + admin_config=admin_config, options=options) + + +def build_example_subscription(name, identifier, admin_config, options, update_rate=180, processing_msg=None, + update_db=True): + dvm_config = build_default_config(identifier) + dvm_config.USE_OWN_VENV = False + dvm_config.SHOWLOG = True + dvm_config.RECONCILE_DB_RELAY_LIST = ["wss://relay.momostr.pink", "wss://relay.mostr.pub/"] + dvm_config.SCHEDULE_UPDATES_SECONDS = update_rate # Every 3 minutes + dvm_config.UPDATE_DATABASE = update_db + # Activate these to use a subscription based model instead + # dvm_config.SUBSCRIPTION_DAILY_COST = 1 + dvm_config.FIX_COST = 0 + dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg + admin_config.LUD16 = dvm_config.LN_ADDRESS + + image = "https://image.nostr.build/b29b6ec4bf9b6184f69d33cb44862db0d90a2dd9a506532e7ba5698af7d36210.jpg", + # Add NIP89 + nip89info = { + "name": name, + "image": image, + "picture": image, + "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", + "lud16": dvm_config.LN_ADDRESS, + "encryptionSupported": True, + "cashuAccepted": True, + "subscription": True, + "personalized": False, + "nip90Params": { + "max_results": { + "required": False, + "values": [], + "description": "The number of maximum results to return (default currently 100)" + } + } + } + + nip89config = NIP89Config() + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.CONTENT = json.dumps(nip89info) + + nip88config = NIP88Config() + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") + nip89config.NAME = name + nip88config.IMAGE = nip89info["image"] + nip88config.TITLE = name + nip88config.AMOUNT_DAILY = 100 + nip88config.AMOUNT_MONTHLY = 2000 + nip88config.CONTENT = "Subscribe to the DVM for unlimited use during your subscription" + nip88config.PERK1DESC = "Unlimited requests" + nip88config.PERK2DESC = "Support NostrDVM & NostrSDK development" + nip88config.PAYMENT_VERIFIER_PUBKEY = "5b5c045ecdf66fb540bdf2049fe0ef7f1a566fa427a4fe50d400a011b65a3a7e" + + # admin_config.UPDATE_PROFILE = False + # admin_config.REBROADCAST_NIP89 = False + # admin_config.REBROADCAST_NIP88 = False + + # admin_config.FETCH_NIP88 = True + # admin_config.EVENTID = "" + # admin_config.PRIVKEY = dvm_config.PRIVATE_KEY + + return DicoverContentCurrentlyPopularMostr(name=name, dvm_config=dvm_config, nip89config=nip89config, + nip88config=nip88config, options=options, + admin_config=admin_config) + + +if __name__ == '__main__': + process_venv(DicoverContentCurrentlyPopularMostr) diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index 57a4e5c..5a2e676 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -223,8 +223,8 @@ async def send_event(event: Event, client: Client, dvm_config, blastr=False): #if blastr: # client.add_relay("wss://nostr.mutinywallet.com") try: - output = await client.send_event(event) - event_id = output.id + event_id = await client.send_event(event) + #event_id = output.id except Exception as e: print(e) event_id = None diff --git a/tests/discovery.py b/tests/discovery.py index 6ad2372..8f785c0 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -7,6 +7,7 @@ import dotenv from nostr_sdk import init_logger, LogLevel, Keys, NostrLibrary from nostr_dvm.tasks.content_discovery_currently_latest_longform import DicoverContentLatestLongForm +from nostr_dvm.tasks.content_discovery_currently_popular_mostr import DicoverContentCurrentlyPopularMostr from nostr_dvm.tasks.content_discovery_currently_popular_nonfollowers import DicoverContentCurrentlyPopularNonFollowers from nostr_dvm.tasks.content_discovery_update_db_only import DicoverContentDBUpdateScheduler @@ -33,6 +34,7 @@ update_profile = False global_update_rate = 120 # set this high on first sync so db can fully sync before another process trys to. use_logger = True +log_level = LogLevel.ERROR @@ -40,7 +42,7 @@ RECONCILE_DB_RELAY_LIST = [ "wss://relay.nostr.net", "wss://relay.nostr.bg", "ws if use_logger: - init_logger(LogLevel.ERROR) + init_logger(log_level) def build_db_scheduler(name, identifier, admin_config, options, image, description, update_rate=600, cost=0, @@ -417,6 +419,55 @@ def build_example_top_zapped(name, identifier, admin_config, options, image, cos admin_config=admin_config, options=options) +def build_example_mostr(name, identifier, admin_config, options, image, cost=0, update_rate=180, processing_msg=None, + update_db=True): + + dvm_config = build_default_config(identifier) + dvm_config.USE_OWN_VENV = False + dvm_config.LOGLEVEL = LogLevel.INFO + # dvm_config.SHOWLOG = True + dvm_config.SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes + dvm_config.UPDATE_DATABASE = update_db + dvm_config.RECONCILE_DB_RELAY_LIST = ["wss://nfrelay.app/?user=activitypub"] + + dvm_config.LOGLEVEL = LogLevel.DEBUG + dvm_config.FIX_COST = cost + # dvm_config.RELAY_LIST = ["wss://dvms.f7z.io", "wss://nostr.oxtr.dev", "wss://relay.nostr.bg", + # "wss://relay.nostr.net"] + dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg + # dvm_config.RELAY_LIST = ["wss://dvms.f7z.io", + # "wss://nostr.mom", "wss://nostr.oxtr.dev", "wss://relay.nostr.bg" + # ] + admin_config.LUD16 = dvm_config.LN_ADDRESS + + # Add NIP89 + nip89info = { + "name": name, + "image": image, + "picture": image, + "about": "I show notes from Mostr.pub and Momostr.pink that are currently popular on Nostr", + "lud16": dvm_config.LN_ADDRESS, + "encryptionSupported": True, + "cashuAccepted": True, + "personalized": False, + "amount": create_amount_tag(cost), + "nip90Params": { + "max_results": { + "required": False, + "values": [], + "description": "The number of maximum results to return (default currently 200)" + } + } + } + + nip89config = NIP89Config() + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.CONTENT = json.dumps(nip89info) + return DicoverContentCurrentlyPopularMostr(name=name, dvm_config=dvm_config, nip89config=nip89config, + admin_config=admin_config, options=options) + + + def playground(): @@ -522,6 +573,33 @@ def playground(): custom_processing_msg=custom_processing_msg) trending_nb.run() + admin_config_mostr = AdminConfig() + admin_config_mostr.REBROADCAST_NIP89 = rebroadcast_NIP89 + admin_config_mostr.REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List + admin_config_mostr.UPDATE_PROFILE = update_profile + #admin_config_mostr.DELETE_NIP89 = True + #admin_config_mostr.PRIVKEY = "" + #admin_config_mostr.EVENTID = "59d0ebe2966426ac359dcb8da214efe34fb735c69099361eae87a426bacf4de2" + #admin_config_mostr.POW = True + custom_processing_msg = ["Looking for popular Content on Mostr"] + + options_mostr = { + "db_name": "db/nostr_mostr.db", + "db_since": 60 * 60 * 2, # 1h since gmt, + } + cost = 0 + image = "https://i.nostr.build/mtkNd3J8m0mqj9nq.jpg" + discovery_mostr = build_example_mostr("Trending on Mostr", + "discovery_mostr", + admin_config=admin_config_mostr, + options=options_mostr, + image=image, + cost=cost, + update_rate=180, + processing_msg=custom_processing_msg, + update_db=True) + discovery_mostr.run() + # Popular Animals (Fluffy frens) admin_config_animals = AdminConfig() diff --git a/tests/discovery_mostr.py b/tests/discovery_mostr.py index 463f3f1..03b4800 100644 --- a/tests/discovery_mostr.py +++ b/tests/discovery_mostr.py @@ -13,14 +13,14 @@ from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.dvmconfig import build_default_config from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag -rebroadcast_NIP89 = False # Announce NIP89 on startup -rebroadcast_NIP65_Relay_List = True -update_profile = True +rebroadcast_NIP89 = True # Announce NIP89 on startup +rebroadcast_NIP65_Relay_List = False +update_profile = False -global_update_rate = 1200 # set this high on first sync so db can fully sync before another process trys to. +global_update_rate = 60 # set this high on first sync so db can fully sync before another process trys to. use_logger = True # these do not support nengentropy -RECONCILE_DB_RELAY_LIST = ["wss://relay.momostr.pink", "wss://relay.mostr.pub/", "wss://relay.noswhere.com", "wss://relay.nostr.band"] # , "wss://relay.snort.social"] +#RECONCILE_DB_RELAY_LIST = ["wss://relay.momostr.pink", "wss://relay.mostr.pub/"] # , "wss://relay.snort.social"] if use_logger: init_logger(LogLevel.DEBUG) @@ -34,7 +34,7 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, # dvm_config.SHOWLOG = True dvm_config.SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes dvm_config.UPDATE_DATABASE = update_db - dvm_config.RECONCILE_DB_RELAY_LIST = RECONCILE_DB_RELAY_LIST + dvm_config.RECONCILE_DB_RELAY_LIST = ["wss://nfrelay.app/?user=activitypub"] dvm_config.LOGLEVEL = LogLevel.DEBUG dvm_config.FIX_COST = cost # dvm_config.RELAY_LIST = ["wss://dvms.f7z.io", "wss://nostr.oxtr.dev", "wss://relay.nostr.bg", @@ -50,7 +50,7 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, "name": name, "image": image, "picture": image, - "about": "I show popular gallery entries", + "about": "I show popular notes from Mostr.pub and Momostr.pink", "lud16": dvm_config.LN_ADDRESS, "encryptionSupported": True, "cashuAccepted": True, @@ -80,7 +80,7 @@ def playground(): admin_config_global_wot.UPDATE_PROFILE = update_profile #admin_config_global_wot.DELETE_NIP89 = True #admin_config_global_wot.PRIVKEY = "" - #admin_config_global_wot.EVENTID = "23306aa72cff48ec98bab7533883ffb7a378ec6b1c09b79ef45907d06550e2a8" + #admin_config_global_wot.EVENTID = "c9dc34d2a2eca8a0d4972210aed1b63a36995cced07e1401d264c3bb48b4b715" #admin_config_global_wot.POW = True custom_processing_msg = ["Looking for popular Content on Mostr"] update_db = True @@ -89,11 +89,11 @@ def playground(): options_mostr = { "db_name": "db/nostr_mostr.db", - "db_since": 60 * 60 * 24 * 365, # 1h since gmt, + "db_since": 60 * 60 * 2, # 1h since gmt, } cost = 0 - image = "https://i.nostr.build/4Rw6lrsH5O0P5zjT.jpg" - discovery_wot = build_example_mostr("Trending on Mostr", + image = "https://i.nostr.build/mtkNd3J8m0mqj9nq.jpg" + discovery_mostr = build_example_mostr("Trending on Mostr", "discovery_mostr", admin_config=admin_config_global_wot, options=options_mostr, @@ -102,7 +102,7 @@ def playground(): update_rate=global_update_rate, processing_msg=custom_processing_msg, update_db=update_db) - discovery_wot.run() + discovery_mostr.run() # discovery_test_sub = content_discovery_currently_popular.build_example_subscription("Currently Popular Notes DVM (with Subscriptions)", "discovery_content_test", admin_config) # discovery_test_sub.run()