forked from indymedia/epicyon
Replace YouTube links, so they get less data
parent
5cf74595dd
commit
2f00cf06e7
4
inbox.py
4
inbox.py
|
@ -59,6 +59,7 @@ from posts import sendToFollowersThread
|
|||
from webinterface import individualPostAsHtml
|
||||
from webinterface import getIconsDir
|
||||
from question import questionUpdateVotes
|
||||
from media import replaceYouTube
|
||||
|
||||
def storeHashTags(baseDir: str,nickname: str,postJsonObject: {}) -> None:
|
||||
"""Extracts hashtags from an incoming post and updates the
|
||||
|
@ -1848,6 +1849,9 @@ def inboxAfterCapabilities(recentPostsCache: {},maxRecentPosts: int, \
|
|||
postJsonObject=messageJson
|
||||
|
||||
if validPostContent(postJsonObject,maxMentions,maxEmoji):
|
||||
# replace YouTube links, so they get less tracking data
|
||||
replaceYouTube(postJsonObject)
|
||||
|
||||
# list of indexes to be updated
|
||||
updateIndexList=['inbox']
|
||||
populateReplies(baseDir,httpPrefix,domain,postJsonObject,maxReplies,debug)
|
||||
|
|
13
media.py
13
media.py
|
@ -19,6 +19,19 @@ from shutil import copyfile
|
|||
from shutil import rmtree
|
||||
from shutil import move
|
||||
|
||||
def replaceYouTube(postJsonObject: {}):
|
||||
"""Replace YouTube with invidio.us
|
||||
This denies Google some, but not all, tracking data
|
||||
"""
|
||||
if not isinstance(postJsonObject['object'], dict):
|
||||
return
|
||||
if not postJsonObject['object'].get('content'):
|
||||
return
|
||||
if 'www.youtube.com' not in postJsonObject['object']['content']:
|
||||
return
|
||||
postJsonObject['object']['content']= \
|
||||
postJsonObject['object']['content'].replace('www.youtube.com','invidio.us')
|
||||
|
||||
def removeMetaData(imageFilename: str,outputFilename: str) -> None:
|
||||
"""Attempts to do this with pure python didn't work well,
|
||||
so better to use a dedicated tool if one is installed
|
||||
|
|
Loading…
Reference in New Issue