This commit is contained in:
parent
e53838570d
commit
a5a6f5180a
|
@ -56,6 +56,8 @@ class SocialSiteId(aenum.Enum):
|
||||||
ITCH_IO_DEVELOPER = 8176
|
ITCH_IO_DEVELOPER = 8176
|
||||||
FIREFOX_PROFILE_BOOKMARKS = 33
|
FIREFOX_PROFILE_BOOKMARKS = 33
|
||||||
COHOST_PROFILE = 117203288
|
COHOST_PROFILE = 117203288
|
||||||
|
SOUNDCLOUD_ARTIST = 3040
|
||||||
|
IGDB_GAME_ID = 5794
|
||||||
|
|
||||||
def wikidata_property(self, client):
|
def wikidata_property(self, client):
|
||||||
return client.get(WIKIDATA_PROPERTIES[self])
|
return client.get(WIKIDATA_PROPERTIES[self])
|
||||||
|
@ -69,6 +71,7 @@ AGGERAGOR_SOCIALS = {
|
||||||
SocialSiteId.CARRD_PAGE,
|
SocialSiteId.CARRD_PAGE,
|
||||||
SocialSiteId.LINK_COLLECTION_PAGE,
|
SocialSiteId.LINK_COLLECTION_PAGE,
|
||||||
SocialSiteId.DANBOORU_ARTIST,
|
SocialSiteId.DANBOORU_ARTIST,
|
||||||
|
SocialSiteId.IGDB_GAME_ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
@enforce_types
|
@enforce_types
|
||||||
|
@ -125,11 +128,13 @@ WIKIDATA_PROPERTIES = {
|
||||||
SocialSiteId.BLUESKY_PROFILE: WikidataInfo(None, 78194383),
|
SocialSiteId.BLUESKY_PROFILE: WikidataInfo(None, 78194383),
|
||||||
SocialSiteId.ITCH_IO_DEVELOPER: WikidataInfo(8176, 22905933),
|
SocialSiteId.ITCH_IO_DEVELOPER: WikidataInfo(8176, 22905933),
|
||||||
SocialSiteId.COHOST_PROFILE: WikidataInfo(None, 117203288),
|
SocialSiteId.COHOST_PROFILE: WikidataInfo(None, 117203288),
|
||||||
|
SocialSiteId.SOUNDCLOUD_ARTIST: WikidataInfo(3040, None),
|
||||||
|
SocialSiteId.IGDB_GAME_ID: WikidataInfo(5794, None),
|
||||||
}
|
}
|
||||||
|
|
||||||
def re_social_subdomain(main_domain):
|
def re_social_subdomain(main_domain):
|
||||||
#return r'^(?:https?:\/\/)?([\w_-]+)\.'+re.escape(main_domain)+'\/?$'
|
#return r'^(?:https?:\/\/)?([\w_-]+)\.'+re.escape(main_domain)+'\/?$'
|
||||||
return r'^(?:https?:\/\/)?([\w_-]+)\.'+re.escape(main_domain)+'(\/.*)?$'
|
return r'^(?:https?:\/\/)?([\w_-]+)\.'+re.escape(main_domain)+r'(\/.*)?$'
|
||||||
|
|
||||||
RE_ID = r'@?([^/]+)'
|
RE_ID = r'@?([^/]+)'
|
||||||
RE_ANY_SUBPATH = r'(|\/|\/.*)$'
|
RE_ANY_SUBPATH = r'(|\/|\/.*)$'
|
||||||
|
@ -140,7 +145,7 @@ def re_social_path(main_domain):
|
||||||
|
|
||||||
def re_social_path_adv(main_domain, *path):
|
def re_social_path_adv(main_domain, *path):
|
||||||
assert not main_domain.startswith('www.'), 'Redundant www.'
|
assert not main_domain.startswith('www.'), 'Redundant www.'
|
||||||
l = [r'^', '(?:https?:\/\/)?', r'(?:www\.)?', re.escape(main_domain)]
|
l = [r'^', r'(?:https?:\/\/)?', r'(?:www\.)?', re.escape(main_domain)]
|
||||||
|
|
||||||
for p in path:
|
for p in path:
|
||||||
if p != RE_ANY_SUBPATH:
|
if p != RE_ANY_SUBPATH:
|
||||||
|
@ -192,7 +197,6 @@ URL_PARSE_DANBOORU_ARTIST = re_social_path_adv('danbooru.donmai.us', 'artists',
|
||||||
URL_PARSE_BANDCAMP = re_social_subdomain('bandcamp.com')
|
URL_PARSE_BANDCAMP = re_social_subdomain('bandcamp.com')
|
||||||
URL_PARSE_BLUESKY = re_social_path_adv('bsky.app', 'profile', RE_ID)
|
URL_PARSE_BLUESKY = re_social_path_adv('bsky.app', 'profile', RE_ID)
|
||||||
URL_PARSE_ITCH_IO_DEVELOPER = re_social_subdomain('itch.io')
|
URL_PARSE_ITCH_IO_DEVELOPER = re_social_subdomain('itch.io')
|
||||||
URL_PARSE_COHOST = re_social_path_adv('cohost.org', RE_ID)
|
|
||||||
|
|
||||||
REGEXES = [
|
REGEXES = [
|
||||||
# Reddit
|
# Reddit
|
||||||
|
@ -295,7 +299,13 @@ REGEXES = [
|
||||||
(URL_PARSE_ITCH_IO_DEVELOPER, SocialSiteId.ITCH_IO_DEVELOPER),
|
(URL_PARSE_ITCH_IO_DEVELOPER, SocialSiteId.ITCH_IO_DEVELOPER),
|
||||||
|
|
||||||
# Cohost
|
# Cohost
|
||||||
(URL_PARSE_COHOST, SocialSiteId.COHOST_PROFILE),
|
(re_social_path_adv('cohost.org', RE_ID), SocialSiteId.COHOST_PROFILE),
|
||||||
|
|
||||||
|
# Soundcloud
|
||||||
|
(re_social_path_adv('soundcloud.com', RE_ID), SocialSiteId.IGDB_GAME_ID),
|
||||||
|
|
||||||
|
# IGDB
|
||||||
|
(re_social_path_adv('igdb.com', 'games', RE_ID), SocialSiteId.IGDB_GAME_ID),
|
||||||
]
|
]
|
||||||
|
|
||||||
WELL_KNOWN_MASTODON_INSTANCES = frozenset({
|
WELL_KNOWN_MASTODON_INSTANCES = frozenset({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user