Updated ID retrieval from response

Tested calls with a response string and it was not extracting the ID.  
Used @wilddom's fork ID parsing and it works.  
Did not include get_root again as he did ($_domain_name comes with appropriate string).
His fork: 931f93c5bb
    
Only thing I wanted now was to disable/fix the `get_root` so it does not use the main domain when it fails on a subdomain.  
For example, if it fails on sub.domain.com it will try with domain.com and since I have both on Dynu, I don't really want that (I want it to just fail and then try again later).  
I guess I will open an issue for that...
This commit is contained in:
Gustavo Arnosti Neves 2018-09-06 19:20:10 -03:00 committed by GitHub
parent 56af0e2c52
commit 1b25c70fc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,7 +161,7 @@ _get_recordid() {
return 0
fi
_dns_record_id=$(printf "%s" "$response" | _egrep_o "{[^}]*}" | grep "\"text_data\":\"$txtvalue\"" | _egrep_o ",[^,]*," | grep ',"id":' | tr -d ",," | cut -d : -f 2)
_dns_record_id=$(printf "%s" "$response" | sed -e 's/[^{]*\({[^}]*}\)[^{]*/\1\n/g' | grep "\"text_data\":\"$txtvalue\"" | sed -e 's/.*"id":\([^,]*\).*/\1/')
return 0
}