mirror of
https://github.com/bellingcat/cisticola.git
synced 2026-06-13 05:48:33 +03:00
changed ORM and Google Sheet sync to reflect converting channels.country to JSONB array, added index for detected_language
This commit is contained in:
@@ -4,6 +4,14 @@ from loguru import logger
|
||||
|
||||
from cisticola.base import Channel, ChannelInfo
|
||||
|
||||
def standardize_country(s):
|
||||
_s = s.split('(')[0].split('?')[0]
|
||||
if _s == 'AUS':
|
||||
return 'AU'
|
||||
else:
|
||||
return _s.strip()
|
||||
|
||||
|
||||
def sync_channels(args, session):
|
||||
logger.info("Synchronizing channels")
|
||||
|
||||
@@ -73,7 +81,7 @@ def sync_channels(args, session):
|
||||
channel.platform = c["platform"]
|
||||
channel.url = c["url"]
|
||||
channel.screenname = c["screenname"]
|
||||
channel.country = c["country"]
|
||||
channel.country = list(map(standardize_country, c["country"].split('/')))
|
||||
channel.influencer = c["influencer"]
|
||||
channel.public = c["public"]
|
||||
channel.chat = c["chat"]
|
||||
@@ -114,7 +122,7 @@ def sync_channels(args, session):
|
||||
channel.platform = c["platform"]
|
||||
channel.url = c["url"]
|
||||
channel.screenname = c["screenname"]
|
||||
channel.country = c["country"]
|
||||
channel.country = list(map(standardize_country, c["country"].split('/')))
|
||||
channel.influencer = c["influencer"]
|
||||
channel.public = c["public"]
|
||||
channel.chat = c["chat"]
|
||||
|
||||
Reference in New Issue
Block a user