aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <donaldshan1@outlook.com>2023-05-04 16:33:28 -0700
committerPinapelz <donaldshan1@outlook.com>2023-05-04 16:33:28 -0700
commit95f604cc62a96b31e2ac0797e447e09b9158efb3 (patch)
tree5c4fedb8b1d83fdfd6c2e78d69cd7c35716c87c1
parent845d954fdca9d55f4cef699711a2a73809cd0d69 (diff)
Implemented ability to handle multiple Holodex Organizations
-rw-r--r--config.py2
-rw-r--r--main.py14
2 files changed, 10 insertions, 6 deletions
diff --git a/config.py b/config.py
index 6eb919a..49135e6 100644
--- a/config.py
+++ b/config.py
@@ -41,7 +41,7 @@ TIMEZONE_STR = "Pacific Standard Time"
ROOT_STORAGE_PATH = ""
# Skip the options below if you are not using Holodex
-HOLODEX_ORG = "Nijisanji"
+HOLODEX_ORG = "Nijisanji,Hololive" # Can be a comma separated list of organizations
ORG_MEMBER_COUNT = 300
UPDATE_LOCAL_RECORDS = True # If true, will update the local records of the channels.txt and exclude_channels.txt files
diff --git a/main.py b/main.py
index ee2f8b6..8f11942 100644
--- a/main.py
+++ b/main.py
@@ -103,11 +103,15 @@ def main(mode=0):
server.create_table(HISTORICAL_TABLE_NAME, TABLE_COLUMNS)
server.create_table(DAY_DIFF_TABLE_NAME, DIFF_COLUMNS)
excluded_channels = []
+ data = []
if mode == 0:
- print("Running Holodex API Data Collection")
- hldex = HolodexAPI(fs.get_api_key("holodex_api_key"), member_count=ORG_MEMBER_COUNT, organization=HOLODEX_ORG)
- data = hldex.get_data_all_channels()
- excluded_channels += hldex.get_exclude_channels()
+ holodex_organizations = HOLODEX_ORG.split(",")
+ print("Running Holodex API Data Collection\n"+"Found "+str(len(holodex_organizations))+" organizations")
+ for org in holodex_organizations:
+ hldex = HolodexAPI(fs.get_api_key("holodex_api_key"), member_count = ORG_MEMBER_COUNT, organization = org)
+ data += hldex.get_data_all_channels()
+ excluded_channels += hldex.get_exclude_channels()
+
elif mode == 1:
print("Running YouTube API Data Collection")
ytapi = YouTubeAPI(fs.get_api_key("youtube_api_key"))
@@ -148,7 +152,7 @@ def generate_channel_files():
if __name__ == "__main__":
- MODE = 1
+ MODE = 0
if len(sys.argv) > 1:
MODE = int(sys.argv[1])
ROOT_STORAGE_PATH = sys.argv[2]
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage