mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
fc65d8e598
commit
c3a95d52a3
34
media.py
34
media.py
|
@ -28,10 +28,10 @@ from shutil import move
|
||||||
from city import spoofGeolocation
|
from city import spoofGeolocation
|
||||||
|
|
||||||
|
|
||||||
def replaceYouTube(postJsonObject: {}, replacementDomain: str,
|
def _replaceSiloDomain(postJsonObject: {},
|
||||||
systemLanguage: str) -> None:
|
siloDomain: str, replacementDomain: str,
|
||||||
"""Replace YouTube with a replacement domain
|
systemLanguage: str) -> None:
|
||||||
This denies Google some, but not all, tracking data
|
"""Replace a silo domain with a replacement domain
|
||||||
"""
|
"""
|
||||||
if not replacementDomain:
|
if not replacementDomain:
|
||||||
return
|
return
|
||||||
|
@ -40,7 +40,7 @@ def replaceYouTube(postJsonObject: {}, replacementDomain: str,
|
||||||
if not postJsonObject['object'].get('content'):
|
if not postJsonObject['object'].get('content'):
|
||||||
return
|
return
|
||||||
contentStr = getBaseContentFromPost(postJsonObject, systemLanguage)
|
contentStr = getBaseContentFromPost(postJsonObject, systemLanguage)
|
||||||
if 'www.youtube.com' not in contentStr:
|
if siloDomain not in contentStr:
|
||||||
return
|
return
|
||||||
contentStr = contentStr.replace('www.youtube.com', replacementDomain)
|
contentStr = contentStr.replace('www.youtube.com', replacementDomain)
|
||||||
postJsonObject['object']['content'] = contentStr
|
postJsonObject['object']['content'] = contentStr
|
||||||
|
@ -48,24 +48,22 @@ def replaceYouTube(postJsonObject: {}, replacementDomain: str,
|
||||||
postJsonObject['object']['contentMap'][systemLanguage] = contentStr
|
postJsonObject['object']['contentMap'][systemLanguage] = contentStr
|
||||||
|
|
||||||
|
|
||||||
|
def replaceYouTube(postJsonObject: {}, replacementDomain: str,
|
||||||
|
systemLanguage: str) -> None:
|
||||||
|
"""Replace YouTube with a replacement domain
|
||||||
|
This denies Google some, but not all, tracking data
|
||||||
|
"""
|
||||||
|
return _replaceSiloDomain(postJsonObject, 'www.youtube.com',
|
||||||
|
replacementDomain, systemLanguage)
|
||||||
|
|
||||||
|
|
||||||
def replaceTwitter(postJsonObject: {}, replacementDomain: str,
|
def replaceTwitter(postJsonObject: {}, replacementDomain: str,
|
||||||
systemLanguage: str) -> None:
|
systemLanguage: str) -> None:
|
||||||
"""Replace Twitter with a replacement domain
|
"""Replace Twitter with a replacement domain
|
||||||
This allows you to view twitter posts without having a twitter account
|
This allows you to view twitter posts without having a twitter account
|
||||||
"""
|
"""
|
||||||
if not replacementDomain:
|
return _replaceSiloDomain(postJsonObject, 'twitter.com',
|
||||||
return
|
replacementDomain, systemLanguage)
|
||||||
if not hasObjectDict(postJsonObject):
|
|
||||||
return
|
|
||||||
if not postJsonObject['object'].get('content'):
|
|
||||||
return
|
|
||||||
contentStr = getBaseContentFromPost(postJsonObject, systemLanguage)
|
|
||||||
if 'twitter.com' not in contentStr:
|
|
||||||
return
|
|
||||||
contentStr = contentStr.replace('twitter.com', replacementDomain)
|
|
||||||
postJsonObject['object']['content'] = contentStr
|
|
||||||
if postJsonObject['object'].get('contentMap'):
|
|
||||||
postJsonObject['object']['contentMap'][systemLanguage] = contentStr
|
|
||||||
|
|
||||||
|
|
||||||
def _removeMetaData(imageFilename: str, outputFilename: str) -> None:
|
def _removeMetaData(imageFilename: str, outputFilename: str) -> None:
|
||||||
|
|
Loading…
Reference in New Issue