\n"
return content
- videoSite = 'https://media.ccc.de'
- if '"' + videoSite in content:
- url = content.split('"' + videoSite)[1]
+ video_site = 'https://media.ccc.de'
+ if '"' + video_site in content:
+ url = content.split('"' + video_site)[1]
if '"' in url:
url = url.split('"')[0]
if not url.endswith('/oembed'):
url = url + '/oembed'
content = \
content + "
\n\n
\n"
@@ -113,13 +115,13 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
if peertube_instances:
# only create an embedded video for a limited set of
# peertube sites.
- peerTubeSites = peertube_instances
+ peertube_sites = peertube_instances
else:
# A default minimal set of peertube instances
# Also see https://peertube_isolation.frama.io/list/ for
# adversarial instances. Nothing in that list should be
# in the defaults below.
- peerTubeSites = (
+ peertube_sites = (
'share.tube',
'visionon.tv',
'peertube.fr',
@@ -127,7 +129,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
'peertube.social',
'videos.lescommuns.org'
)
- for site in peerTubeSites:
+ for site in peertube_sites:
site = site.strip()
if not site:
continue
@@ -135,19 +137,19 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
continue
if '.' not in site:
continue
- siteStr = site
+ site_str = site
if site.startswith('http://'):
site = site.replace('http://', '')
elif site.startswith('https://'):
site = site.replace('https://', '')
if site.endswith('.onion') or site.endswith('.i2p'):
- siteStr = 'http://' + site
+ site_str = 'http://' + site
else:
- siteStr = 'https://' + site
- siteStr = '"' + siteStr
- if siteStr not in content:
+ site_str = 'https://' + site
+ site_str = '"' + site_str
+ if site_str not in content:
continue
- url = content.split(siteStr)[1]
+ url = content.split(site_str)[1]
if '"' not in url:
continue
url = url.split('"')[0].replace('/watch/', '/embed/')
@@ -177,26 +179,26 @@ def _add_embedded_audio(translate: {}, content: str) -> str:
extension = '.ogg'
words = content.strip('\n').split(' ')
- for w in words:
- if extension not in w:
+ for wrd in words:
+ if extension not in wrd:
continue
- w = w.replace('href="', '').replace('">', '')
- if w.endswith('.'):
- w = w[:-1]
- if w.endswith('"'):
- w = w[:-1]
- if w.endswith(';'):
- w = w[:-1]
- if w.endswith(':'):
- w = w[:-1]
- if not w.endswith(extension):
+ wrd = wrd.replace('href="', '').replace('">', '')
+ if wrd.endswith('.'):
+ wrd = wrd[:-1]
+ if wrd.endswith('"'):
+ wrd = wrd[:-1]
+ if wrd.endswith(';'):
+ wrd = wrd[:-1]
+ if wrd.endswith(':'):
+ wrd = wrd[:-1]
+ if not wrd.endswith(extension):
continue
- if not valid_url_prefix(w):
+ if not valid_url_prefix(wrd):
continue
content += \
'
\n\n
\n'
@@ -219,28 +221,28 @@ def _add_embedded_video(translate: {}, content: str) -> str:
extension = '.ogv'
words = content.strip('\n').split(' ')
- for w in words:
- if extension not in w:
+ for wrd in words:
+ if extension not in wrd:
continue
- w = w.replace('href="', '').replace('">', '')
- if w.endswith('.'):
- w = w[:-1]
- if w.endswith('"'):
- w = w[:-1]
- if w.endswith(';'):
- w = w[:-1]
- if w.endswith(':'):
- w = w[:-1]
- if not w.endswith(extension):
+ wrd = wrd.replace('href="', '').replace('">', '')
+ if wrd.endswith('.'):
+ wrd = wrd[:-1]
+ if wrd.endswith('"'):
+ wrd = wrd[:-1]
+ if wrd.endswith(';'):
+ wrd = wrd[:-1]
+ if wrd.endswith(':'):
+ wrd = wrd[:-1]
+ if not wrd.endswith(extension):
continue
- if not valid_url_prefix(w):
+ if not valid_url_prefix(wrd):
continue
content += \
'