Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MBin Magazine Support (+ remove KBin support) #204

Merged
merged 15 commits into from
Jan 8, 2025
Prev Previous commit
Next Next commit
output script changes
tgxn committed Jan 7, 2025
commit cda3632f2c37243ff58bf22ba5ac2016c283ed5e
2 changes: 2 additions & 0 deletions crawler/src/lib/const.ts
Original file line number Diff line number Diff line change
@@ -38,6 +38,8 @@ export const CRAWL_AGED_TIME = {

// if a server is identified as a non-lemmy server, ho often should we wait before checking again?
FEDIVERSE: hoursToMs(2 * 24), // 2 days

MAGAZINE: hoursToMs(8),
};

// consider for deletion after they haven't been seen for this long
3 changes: 0 additions & 3 deletions crawler/src/lib/crawlStorage.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ import logging from "./logging";
// core
import InstanceStore from "./storage/instance";
import CommunityStore from "./storage/community";
import KBinStore from "./storage/kbin";
import MBinStore from "./storage/mbin";

// supporting
@@ -29,7 +28,6 @@ export class CrawlStorage {
public fediverse: FediverseStore;
public fediseer: FediseerStore;
public tracking: TrackingStore;
public kbin: KBinStore;
public mbin: MBinStore;

constructor() {
@@ -46,7 +44,6 @@ export class CrawlStorage {
this.fediverse = new FediverseStore(this);
this.fediseer = new FediseerStore(this);
this.tracking = new TrackingStore(this);
this.kbin = new KBinStore(this);
this.mbin = new MBinStore(this);
}

66 changes: 0 additions & 66 deletions crawler/src/lib/storage/kbin.ts

This file was deleted.

10 changes: 9 additions & 1 deletion crawler/src/lib/storage/mbin.ts
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ export type IMagazineData = {
serverSoftwareVersion: any;
isPostingRestrictedToMods: boolean;
lastCrawled?: number;
baseurl: string;
};
export type IMagazineDataKeyValue = {
[key: string]: IMagazineData;
@@ -50,7 +51,14 @@ export default class MBinStore {
}

async getAll(): Promise<IMagazineData[]> {
return this.storage.listRedis(`mbin_magazine:*`);
const magazineKeyValue = this.storage.listRedisWithKeys(`mbin_magazine:*`);

// put baseUrl into the magazine object
for (const key in magazineKeyValue) {
magazineKeyValue[key].baseurl = key.split(":")[1];
}

return Object.values(magazineKeyValue);
}

async getAllWithKeys(): Promise<IMagazineDataKeyValue> {
Loading