mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-28 22:41:08 -05:00
SpiffyTitles: update mimeTypes default config
This commit is contained in:
parent
c14b0852a7
commit
f72a0afdab
@ -74,6 +74,11 @@ This means that you can change whether a handler is enabled, or what the templat
|
|||||||
|
|
||||||
`default.language` - Accept-Language header string. https://tools.ietf.org/html/rfc7231#section-5.3.5
|
`default.language` - Accept-Language header string. https://tools.ietf.org/html/rfc7231#section-5.3.5
|
||||||
|
|
||||||
|
<<<<<<< Updated upstream
|
||||||
|
=======
|
||||||
|
`default.mimeTypes` - Comma separated list of strings of mime types to parse for html title. Default value: `text/html`. You shouldn't need to change this.
|
||||||
|
|
||||||
|
>>>>>>> Stashed changes
|
||||||
`default.template` - This is the template used when showing the title of a link.
|
`default.template` - This is the template used when showing the title of a link.
|
||||||
|
|
||||||
Default value: `^ {{title}}`
|
Default value: `^ {{title}}`
|
||||||
|
@ -37,7 +37,7 @@ import supybot.world as world
|
|||||||
|
|
||||||
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
||||||
# in here if you're keeping the plugin in CVS or some similar system.
|
# in here if you're keeping the plugin in CVS or some similar system.
|
||||||
__version__ = "2020.05.10+git"
|
__version__ = "2020.05.21+git"
|
||||||
|
|
||||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||||
__author__ = supybot.Author("butterscotchstallion", "butterscotchstallion", "")
|
__author__ = supybot.Author("butterscotchstallion", "butterscotchstallion", "")
|
||||||
|
@ -90,15 +90,6 @@ conf.registerChannelValue(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Mime types
|
|
||||||
conf.registerGlobalValue(
|
|
||||||
SpiffyTitles,
|
|
||||||
"mimeTypes",
|
|
||||||
registry.CommaSeparatedListOfStrings(
|
|
||||||
["text/html"], _("""Acceptable mime types for displaying titles""")
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Ignored domain pattern
|
# Ignored domain pattern
|
||||||
conf.registerChannelValue(
|
conf.registerChannelValue(
|
||||||
SpiffyTitles,
|
SpiffyTitles,
|
||||||
@ -191,7 +182,45 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.default,
|
SpiffyTitles.default,
|
||||||
"enabled",
|
"enabled",
|
||||||
registry.Boolean(
|
registry.Boolean(
|
||||||
True, _("""Whether to add additional information about regular links""")
|
True, _("""Whether to add additional information about regular links.""")
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
conf.registerChannelValue(
|
||||||
|
SpiffyTitles.default,
|
||||||
|
"mimeTypes",
|
||||||
|
registry.CommaSeparatedListOfStrings(
|
||||||
|
["text/html,application/xhtml+xml"], _("""Acceptable mime types for parsing html titles.""")
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
conf.registerChannelValue(
|
||||||
|
SpiffyTitles.default,
|
||||||
|
"language",
|
||||||
|
registry.String(
|
||||||
|
"en-US, en;q=0.8",
|
||||||
|
_(
|
||||||
|
"""
|
||||||
|
Accept-Language header string.
|
||||||
|
https://tools.ietf.org/html/rfc7231#section-5.3.5
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
conf.registerChannelValue(
|
||||||
|
SpiffyTitles.default,
|
||||||
|
"userAgents",
|
||||||
|
registry.CommaSeparatedListOfStrings(
|
||||||
|
[
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101"
|
||||||
|
" Firefox/75.0",
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101"
|
||||||
|
" Firefox/76.0",
|
||||||
|
"Mozilla/5.0 (Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0",
|
||||||
|
"Mozilla/5.0 (Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0",
|
||||||
|
],
|
||||||
|
_("""Reported user agent when fetching links"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -214,8 +243,10 @@ conf.registerGlobalValue(
|
|||||||
"userAgents",
|
"userAgents",
|
||||||
registry.CommaSeparatedListOfStrings(
|
registry.CommaSeparatedListOfStrings(
|
||||||
[
|
[
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0",
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101"
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",
|
" Firefox/75.0",
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101"
|
||||||
|
" Firefox/76.0",
|
||||||
"Mozilla/5.0 (Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0",
|
"Mozilla/5.0 (Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0",
|
||||||
"Mozilla/5.0 (Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0",
|
"Mozilla/5.0 (Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0",
|
||||||
],
|
],
|
||||||
@ -319,9 +350,9 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.reddit,
|
SpiffyTitles.reddit,
|
||||||
"linkThreadTemplate",
|
"linkThreadTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"/r/{{subreddit}}{% if title %} :: {{title}}{% endif %} :: {{score}} "
|
"/r/{{subreddit}}{% if title %} :: {{title}}{% endif %} :: {{score}} points"
|
||||||
"points ({{percent}}) :: {{comments}} comments :: Posted {{age}} by "
|
" ({{percent}}) :: {{comments}} comments :: Posted {{age}} by {{author}}{% if"
|
||||||
"{{author}}{% if url %} :: {{url}} ({{domain}}){% endif %}",
|
" url %} :: {{url}} ({{domain}}){% endif %}",
|
||||||
_("""Template used for Reddit link thread title responses"""),
|
_("""Template used for Reddit link thread title responses"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -330,9 +361,9 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.reddit,
|
SpiffyTitles.reddit,
|
||||||
"textThreadTemplate",
|
"textThreadTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"/r/{{subreddit}}{% if title %} :: {{title}}{% endif %}{% if extract %} "
|
"/r/{{subreddit}}{% if title %} :: {{title}}{% endif %}{% if extract %} ::"
|
||||||
":: {{extract}}{% endif %} :: {{score}} points ({{percent}}) :: {{comments}} "
|
" {{extract}}{% endif %} :: {{score}} points ({{percent}}) :: {{comments}}"
|
||||||
"comments :: Posted {{age}} by {{author}}",
|
" comments :: Posted {{age}} by {{author}}",
|
||||||
_("""Template used for Reddit text thread title responses"""),
|
_("""Template used for Reddit text thread title responses"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -341,8 +372,8 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.reddit,
|
SpiffyTitles.reddit,
|
||||||
"commentTemplate",
|
"commentTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"/r/{{subreddit}}{% if extract %} :: {{extract}}{% endif %} :: "
|
"/r/{{subreddit}}{% if extract %} :: {{extract}}{% endif %} :: {{score}} points"
|
||||||
'{{score}} points :: Posted {{age}} by {{author}} on "{{title}}"',
|
' :: Posted {{age}} by {{author}} on "{{title}}"',
|
||||||
_("""Template used for Reddit comment title responses"""),
|
_("""Template used for Reddit comment title responses"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -351,9 +382,9 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.reddit,
|
SpiffyTitles.reddit,
|
||||||
"userTemplate",
|
"userTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"/u/{{user}}{% if gold %} :: (GOLD{% if mod %}, MOD{% endif %}){% endif %} "
|
"/u/{{user}}{% if gold %} :: (GOLD{% if mod %}, MOD{% endif %}){% endif %} ::"
|
||||||
":: Joined: {{created}} :: Link karma: {{link_karma}} :: Comment karma: "
|
" Joined: {{created}} :: Link karma: {{link_karma}} :: Comment karma:"
|
||||||
"{{comment_karma}}",
|
" {{comment_karma}}",
|
||||||
_("""Template used for Reddit user page title responses"""),
|
_("""Template used for Reddit user page title responses"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -401,11 +432,11 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.youtube,
|
SpiffyTitles.youtube,
|
||||||
"template",
|
"template",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {{yt_logo}} :: {{title}} {%if timestamp%} @ {{timestamp}}{% endif %} "
|
"^ {{yt_logo}} :: {{title}} {%if timestamp%} @ {{timestamp}}{% endif %} ::"
|
||||||
":: Duration: {{duration}} :: Views: {{view_count}} :: Uploader: "
|
" Duration: {{duration}} :: Views: {{view_count}} :: Uploader:"
|
||||||
"{{channel_title}} :: Uploaded: {{published}} :: {{like_count}} likes :: "
|
" {{channel_title}} :: Uploaded: {{published}} :: {{like_count}} likes ::"
|
||||||
"{{dislike_count}} dislikes :: {{favorite_count}} favorites :: "
|
" {{dislike_count}} dislikes :: {{favorite_count}} favorites ::"
|
||||||
"{{comment_count}} comments",
|
" {{comment_count}} comments",
|
||||||
_("""Template used for YouTube title responses"""),
|
_("""Template used for YouTube title responses"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -434,10 +465,10 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.imgur,
|
SpiffyTitles.imgur,
|
||||||
"imageTemplate",
|
"imageTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {%if section %}[{{section}}] {% endif %}{% if title %}{{title}} :: "
|
"^ {%if section %}[{{section}}] {% endif %}{% if title %}{{title}} :: {% endif"
|
||||||
"{% endif %}{{type}} {{width}}x{{height}} {{file_size}} :: {{view_count}} "
|
" %}{{type}} {{width}}x{{height}} {{file_size}} :: {{view_count}} views :: {%if"
|
||||||
"views :: {%if nsfw == None %}not sure if safe for work{% elif nsfw == True %}"
|
" nsfw == None %}not sure if safe for work{% elif nsfw == True %}not safe for"
|
||||||
"not safe for work!{% else %}safe for work{% endif %}",
|
" work!{% else %}safe for work{% endif %}",
|
||||||
_("""imgur image template"""),
|
_("""imgur image template"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -446,10 +477,10 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.imgur,
|
SpiffyTitles.imgur,
|
||||||
"albumTemplate",
|
"albumTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {%if section %}[{{section}}] {% endif %}{% if title %}{{title}} :: "
|
"^ {%if section %}[{{section}}] {% endif %}{% if title %}{{title}} :: {% endif"
|
||||||
"{% endif %}{{image_count}} images :: {{view_count}} views :: "
|
" %}{{image_count}} images :: {{view_count}} views :: {%if nsfw == None %}not"
|
||||||
"{%if nsfw == None %}not sure if safe for work{% elif nsfw == True %}"
|
" sure if safe for work{% elif nsfw == True %}not safe for work!{% else %}safe"
|
||||||
"not safe for work!{% else %}safe for work{% endif %}",
|
" for work{% endif %}",
|
||||||
_("""imgur album template"""),
|
_("""imgur album template"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -472,8 +503,8 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.dailymotion,
|
SpiffyTitles.dailymotion,
|
||||||
"template",
|
"template",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ [{{ownerscreenname}}] {{title}} :: Duration: {{duration}} :: "
|
"^ [{{ownerscreenname}}] {{title}} :: Duration: {{duration}} :: {{views_total}}"
|
||||||
"{{views_total}} views",
|
" views",
|
||||||
_("""Template used for Vimeo title responses"""),
|
_("""Template used for Vimeo title responses"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -511,8 +542,8 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.twitch,
|
SpiffyTitles.twitch,
|
||||||
"channelTemplate",
|
"channelTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {{twitch_logo}} :: {{display_name}} {%if description%}:: "
|
"^ {{twitch_logo}} :: {{display_name}} {%if description%}:: {{description}}"
|
||||||
"{{description}} {%endif%}:: Viewers: {{view_count}}",
|
" {%endif%}:: Viewers: {{view_count}}",
|
||||||
_("""twitch.tv channel template"""),
|
_("""twitch.tv channel template"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -521,10 +552,10 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.twitch,
|
SpiffyTitles.twitch,
|
||||||
"streamTemplate",
|
"streamTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {{twitch_logo}} :: {{display_name}} :: (LIVE) "
|
"^ {{twitch_logo}} :: {{display_name}} :: (LIVE) {%if"
|
||||||
"{%if game_name%}[{{game_name}}] {%endif%}{%if title%}:: {{title}} "
|
" game_name%}[{{game_name}}] {%endif%}{%if title%}:: {{title}} {%endif%}::"
|
||||||
"{%endif%}:: Created: {{created_at}} :: Viewers: {{view_count}} "
|
" Created: {{created_at}} :: Viewers: {{view_count}} {%if description%}::"
|
||||||
"{%if description%}:: {{description}}{%endif%}",
|
" {{description}}{%endif%}",
|
||||||
_("""twitch.tv stream template"""),
|
_("""twitch.tv stream template"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -533,9 +564,9 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.twitch,
|
SpiffyTitles.twitch,
|
||||||
"videoTemplate",
|
"videoTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {{twitch_logo}} :: {{display_name}} {%if title%}:: {{title}} {%endif%}}:: "
|
"^ {{twitch_logo}} :: {{display_name}} {%if title%}:: {{title}} {%endif%}}::"
|
||||||
"Duration: {{duration}} :: Created: {{created_at}} {%if description%}:: "
|
" Duration: {{duration}} :: Created: {{created_at}} {%if description%}::"
|
||||||
"{{description}} {%endif%}:: Viewers: {{view_count}}",
|
" {{description}} {%endif%}:: Viewers: {{view_count}}",
|
||||||
_("""twitch.tv video template"""),
|
_("""twitch.tv video template"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -544,9 +575,9 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.twitch,
|
SpiffyTitles.twitch,
|
||||||
"clipTemplate",
|
"clipTemplate",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {{twitch_logo}} :: {{display_name}} {%if game_name%}:: [{{game_name}}] "
|
"^ {{twitch_logo}} :: {{display_name}} {%if game_name%}:: [{{game_name}}]"
|
||||||
"{%endif%}{%if title%}:: {{title}} {%endif%}:: Created: {{created_at}} :: "
|
" {%endif%}{%if title%}:: {{title}} {%endif%}:: Created: {{created_at}} ::"
|
||||||
"Viewers: {{view_count}} {%if description%}:: {{description}}{%endif%}",
|
" Viewers: {{view_count}} {%if description%}:: {{description}}{%endif%}",
|
||||||
_("""twitch.tv clip template"""),
|
_("""twitch.tv clip template"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -567,8 +598,8 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.vimeo,
|
SpiffyTitles.vimeo,
|
||||||
"template",
|
"template",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {{title}} :: Duration: {{duration}} :: {{stats_number_of_plays}} plays "
|
"^ {{title}} :: Duration: {{duration}} :: {{stats_number_of_plays}} plays ::"
|
||||||
":: {{stats_number_of_comments}} comments",
|
" {{stats_number_of_comments}} comments",
|
||||||
_("""Template used for Vimeo title responses"""),
|
_("""Template used for Vimeo title responses"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -605,10 +636,10 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.imdb,
|
SpiffyTitles.imdb,
|
||||||
"template",
|
"template",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {{imdb_logo}} :: {{title}} ({{year}}, {{country}}, [{{rated}}], {{genre}}, "
|
"^ {{imdb_logo}} :: {{title}} ({{year}}, {{country}}, [{{rated}}], {{genre}},"
|
||||||
"{{runtime}}) :: IMDb: {{imdb_rating}} | MC: {{metascore}} | RT: "
|
" {{runtime}}) :: IMDb: {{imdb_rating}} | MC: {{metascore}} | RT:"
|
||||||
"{{tomatoMeter}} :: {{plot}} :: Director: {{director}} :: Cast: {{actors}} "
|
" {{tomatoMeter}} :: {{plot}} :: Director: {{director}} :: Cast: {{actors}} ::"
|
||||||
":: Writer: {{writer}}",
|
" Writer: {{writer}}",
|
||||||
_("""IMDB title template"""),
|
_("""IMDB title template"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -631,8 +662,8 @@ conf.registerChannelValue(
|
|||||||
SpiffyTitles.coub,
|
SpiffyTitles.coub,
|
||||||
"template",
|
"template",
|
||||||
registry.String(
|
registry.String(
|
||||||
"^ {%if not_safe_for_work %}NSFW{% endif %} [{{channel.title}}] {{title}} :: "
|
"^ {%if not_safe_for_work %}NSFW{% endif %} [{{channel.title}}] {{title}} ::"
|
||||||
"{{views_count}} views :: {{likes_count}} likes :: {{recoubs_count}} recoubs",
|
" {{views_count}} views :: {{likes_count}} likes :: {{recoubs_count}} recoubs",
|
||||||
_("""Uses Coub API to get additional information about coub.com links"""),
|
_("""Uses Coub API to get additional information about coub.com links"""),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -34,13 +34,7 @@ import supybot.callbacks as callbacks
|
|||||||
import supybot.utils as utils
|
import supybot.utils as utils
|
||||||
import supybot.ircdb as ircdb
|
import supybot.ircdb as ircdb
|
||||||
import supybot.log as log
|
import supybot.log as log
|
||||||
import re
|
import re, sys, random, time, json, unicodedata, datetime
|
||||||
import sys
|
|
||||||
import random
|
|
||||||
import time
|
|
||||||
import json
|
|
||||||
import unicodedata
|
|
||||||
import datetime
|
|
||||||
from urllib.parse import urlparse, parse_qsl
|
from urllib.parse import urlparse, parse_qsl
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
@ -169,7 +163,8 @@ class SpiffyTitles(callbacks.Plugin):
|
|||||||
if not self.is_channel_allowed(channel):
|
if not self.is_channel_allowed(channel):
|
||||||
log.debug(
|
log.debug(
|
||||||
"SpiffyTitles: not responding to link in %s due to black/white "
|
"SpiffyTitles: not responding to link in %s due to black/white "
|
||||||
"list restrictions" % (channel)
|
"list restrictions"
|
||||||
|
% (channel)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
urls = self.get_urls_from_message(message)
|
urls = self.get_urls_from_message(message)
|
||||||
@ -210,8 +205,8 @@ class SpiffyTitles(callbacks.Plugin):
|
|||||||
log.debug("SpiffyTitles: could not get a title for %s" % (url))
|
log.debug("SpiffyTitles: could not get a title for %s" % (url))
|
||||||
else:
|
else:
|
||||||
log.debug(
|
log.debug(
|
||||||
"SpiffyTitles: could not get a title for %s but default \
|
"SpiffyTitles: could not get a title for %s but default "
|
||||||
handler is disabled"
|
" handler is disabled"
|
||||||
% (url)
|
% (url)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -445,7 +440,7 @@ class SpiffyTitles(callbacks.Plugin):
|
|||||||
content_type = (
|
content_type = (
|
||||||
request.headers.get("content-type").split(";")[0].strip()
|
request.headers.get("content-type").split(";")[0].strip()
|
||||||
)
|
)
|
||||||
acceptable_types = self.registryValue("mimeTypes")
|
acceptable_types = self.registryValue("default.mimeTypes")
|
||||||
log.debug("SpiffyTitles: content type %s" % (content_type))
|
log.debug("SpiffyTitles: content type %s" % (content_type))
|
||||||
if content_type in acceptable_types:
|
if content_type in acceptable_types:
|
||||||
text = request.content
|
text = request.content
|
||||||
@ -1042,7 +1037,8 @@ class SpiffyTitles(callbacks.Plugin):
|
|||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
self.log.error(
|
self.log.error(
|
||||||
"SpiffyTitles: KeyError parsing Twitch.TV JSON "
|
"SpiffyTitles: KeyError parsing Twitch.TV JSON "
|
||||||
"response: %s" % (str(e))
|
"response: %s"
|
||||||
|
% (str(e))
|
||||||
)
|
)
|
||||||
elif link_type == "video":
|
elif link_type == "video":
|
||||||
data = response
|
data = response
|
||||||
@ -1125,7 +1121,8 @@ class SpiffyTitles(callbacks.Plugin):
|
|||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
self.log.error(
|
self.log.error(
|
||||||
"SpiffyTitles: KeyError parsing Twitch.TV JSON "
|
"SpiffyTitles: KeyError parsing Twitch.TV JSON "
|
||||||
"response: %s" % (str(e))
|
"response: %s"
|
||||||
|
% (str(e))
|
||||||
)
|
)
|
||||||
game_id = data["game_id"]
|
game_id = data["game_id"]
|
||||||
game_name = game_id
|
game_name = game_id
|
||||||
@ -1186,7 +1183,8 @@ class SpiffyTitles(callbacks.Plugin):
|
|||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
self.log.error(
|
self.log.error(
|
||||||
"SpiffyTitles: KeyError parsing Twitch.TV JSON "
|
"SpiffyTitles: KeyError parsing Twitch.TV JSON "
|
||||||
"response: %s" % (str(e))
|
"response: %s"
|
||||||
|
% (str(e))
|
||||||
)
|
)
|
||||||
title = data["title"]
|
title = data["title"]
|
||||||
view_count = data["view_count"]
|
view_count = data["view_count"]
|
||||||
@ -1436,8 +1434,10 @@ class SpiffyTitles(callbacks.Plugin):
|
|||||||
"comment": {
|
"comment": {
|
||||||
"pattern": r"^/r/(?P<subreddit>[^/]+)/comments/(?P<thread>[^/]+)/"
|
"pattern": r"^/r/(?P<subreddit>[^/]+)/comments/(?P<thread>[^/]+)/"
|
||||||
r"[^/]+/(?P<comment>\w+/?)$",
|
r"[^/]+/(?P<comment>\w+/?)$",
|
||||||
"url": "https://www.reddit.com/r/{subreddit}/comments/{thread}/x/"
|
"url": (
|
||||||
"{comment}.json",
|
"https://www.reddit.com/r/{subreddit}/comments/{thread}/x/"
|
||||||
|
"{comment}.json"
|
||||||
|
),
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"pattern": r"^/u(?:ser)?/(?P<user>[^/]+)/?$",
|
"pattern": r"^/u(?:ser)?/(?P<user>[^/]+)/?$",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user