Skip to content

Instantly share code, notes, and snippets.

@wafer-li
Last active December 18, 2023 06:13
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 wafer-li/023308dd7889fab75e4d911f903815c7 to your computer and use it in GitHub Desktop.
Save wafer-li/023308dd7889fab75e4d911f903815c7 to your computer and use it in GitHub Desktop.
Get Contacts in China from RadioID.net and change to YSHON AR-55A format
import requests
import csv
def main():
response = requests.get('https://database.radioid.net/static/user.csv')
with open('user.csv', 'wb') as csv_file:
csv_file.write(response.content)
with open('user.csv', newline='') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
next(csv_reader)
with open('generated.csv', 'w', newline='') as write_csv_file:
csv_writer = csv.writer(write_csv_file, delimiter=',')
csv_writer.writerow(['联系人名称', '呼叫类型', '呼叫ID'])
csv_writer.writerow(['全呼', '3', '16777215'])
csv_writer.writerow(['46001', '1', '46001'])
for row in csv_reader:
radio_id = row[0]
callsign = row[1]
country = row[6]
if country == 'China':
csv_writer.writerow([callsign, '2', radio_id])
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment