How to export your Diaspora contacts II
This might work quicker as the last version which used Notepad++ but it depends on your likes and uses the Diaspora export function to be found on your D* settings page, Powershell and two additional tools to be installed in advance. Though the first run might take a while due to dpendencies and preparation, your future contact exports are done in no time. It is an adaption of a linux oneliner posted by Benjamin Neff which is beautifully short:
zcat username_diaspora_data_random.json.gz | jq '.user.contacts[] | select(.followed).account_id' -r

This is an adaption for Windows. Though it's 'a little bit' longer (Windows doesn't come with zcat and jq and half of it is header and comments, I could spare them and shrink the 6 real code lines to 3 but it's easier to read and change this way I'd say), it works just the same. It takes your Diaspora export file (*.json.gz) and extracts your contacts to a text file into the same folder. Tested on Win10 Build 21H2. Do the following things:

  • go to your Diaspora settings page at https://diasp.org/user/edit and scroll down to the bottom
  • click on the download profile button
  • it usually says something like 'we'll generate the data for you, please come back later'
  • come back later
  • download your profile export at https://diasp.org/user/download_profile
  • make a copy of the gzip file you downloaded and name the copy 'diaspora_data.json.gz'
  • copy the script below to a .ps1 file in the same folder
  • open up a powershell and run the script
  • you'll find your contacts in the diaspora_data.json.txt file
###############################
# diaspora_contact_exporter.ps1
###############################

$7z = 'D:\Program Files\7-Zip\7z.exe'
$exp = 'diaspora_data.json.gz'
$json = [io.path]::GetFileNameWithoutExtension($exp)
$txt = $json + '.txt'
.$7z e $exp
jq '.user.contacts[] | select(.followed).account_id' -r $json | sort | tee $txt

<###############################
Dependency: jq
- download https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe and install
- or with chocolatey: choco install jq

Dependency: 7-Zip
- download https://7-zip.org/a/7z2107-x64.exe and install
- or with chocolatey: choco install 7z
###############################>

#diaspora #contacts #import #export

There are no comments yet.