Skip to content

Instantly share code, notes, and snippets.

@basilesimon
Created March 28, 2025 11:31
Show Gist options
  • Save basilesimon/bd3aad1246dc2e4cca4a770fc7925c9a to your computer and use it in GitHub Desktop.
Save basilesimon/bd3aad1246dc2e4cca4a770fc7925c9a to your computer and use it in GitHub Desktop.
Batch set Attributes
filename name description author publication_datetime event narrative general_narrative facebook_total twitter_total telegram_engagement overall_engagement dateCrawled sourceId authsign_domain URL
edbcfd1d0bcaa2682560616f25397eed249ec02d29973afee2be053ecb719e3b Володин: признание ЛНР и ДНР остановит гуманитарную катастрофу Authenticated web archive of [ https://regnum.ru/news/3514149.html] captured on 2023-02-17 Digital Forensic Research Lab 2022-02-22T08:03:00Z Recognition of Donbas independance The Russian army will establish peace Russia is seeking peace 0 0 0 0 2023-02-17T02:24:36Z 6936781112 authsign.starlinglab.org https://regnum.ru/news/3514149.html
#!/bin/bash
CSV_FILE="data.csv"
CID="bafybeiezchhejrg2fgvg4z5nikktha7tcv7pea7hafbpbzxcslc2q2sgei"
python3 -c "
import csv
import subprocess
import sys
with open('$CSV_FILE', newline='') as f:
reader = csv.reader(f)
headers = next(reader) # Get column names
for row in reader:
for i, cell in enumerate(row):
if cell.strip(): # Skip empty cells
column = headers[i]
cmd = ['starling', 'attr', 'set',
'--attr', column,
'--str', cell,
'--index=true',
'$CID']
subprocess.run(cmd)
print(f'Set {column}: {cell}')
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment