~kris/hacks

sbot

ref: 57c09c8c4fa2cd2479d9ff83a68b7fb447757a13 sbot/detect.h -rw-r--r-- 1.1 KiB
57c09c8c — Kris Yotam chore: sync local state after restore (push updates, no pull) a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* See LICENSE file for copyright and license details. */

#ifndef DETECT_H
#define DETECT_H

/* Detected site/CMS types */
typedef enum {
	SITE_UNKNOWN,
	SITE_WORDPRESS,
	SITE_BLOGGER,
	SITE_HUGO,
	SITE_JEKYLL,
	SITE_GHOST,
	SITE_DRUPAL,
	SITE_MEDIAWIKI
} SiteType;

/* Detection result with hints for archiving */
typedef struct {
	SiteType type;
	const char *name;       /* human-readable CMS name */
	char *feed_url;         /* RSS/Atom feed URL if found */
	char *api_url;          /* REST API base if found */
	char *sitemap_url;      /* sitemap.xml URL if found */
	int has_json_api;       /* site has a JSON API */
} SiteInfo;

/* Detect CMS type from HTML and URL */
SiteInfo *detect_site(const char *html, const char *url);

/* Free detection result */
void siteinfo_free(SiteInfo *info);

/* Get sitemap URLs for a detected site */
char **detect_sitemap_urls(SiteInfo *info, const char *domain,
                           int *count);

/* Get additional seed URLs based on CMS type */
char **detect_seed_urls(SiteInfo *info, const char *domain,
                        int *count);

#endif /* DETECT_H */