Skip to content

Instantly share code, notes, and snippets.

@ridgewell
Created March 24, 2023 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ridgewell/72958c08aa04d8c79b94aec36692852f to your computer and use it in GitHub Desktop.
Save ridgewell/72958c08aa04d8c79b94aec36692852f to your computer and use it in GitHub Desktop.
Extract Mysterium VPN nodes to a CSV File
import requests
import csv
# Make a request to the API
response = requests.get('https://discovery.mysterium.network/api/v3/proposals')
# Extract the JSON data
data = response.json()
# Create a CSV file and write the data to it
with open('mysterium_proposals.csv', 'w', newline='') as csvfile:
writer = csv.writer(csvfile)
# Write the headers
writer.writerow(['id', 'format', 'compatibility', 'provider_id', 'service_type', 'continent', 'country', 'region', 'city', 'asn', 'isp', 'ip_type', 'quality', 'latency', 'bandwidth', 'uptime'])
# Write each proposal as a row in the CSV file
for proposal in data:
quality = proposal['quality']
writer.writerow([
proposal['id'],
proposal['format'],
proposal['compatibility'],
proposal['provider_id'],
proposal['service_type'],
proposal['location'].get('continent'),
proposal['location'].get('country'),
proposal['location'].get('region'),
proposal['location'].get('city'),
proposal['location'].get('asn'),
proposal['location'].get('isp'),
proposal['location'].get('ip_type'),
quality.get('quality'),
quality.get('latency'),
quality.get('bandwidth'),
quality.get('uptime')
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment