我有一个JSON对象,其中包含以下详细信息:
<table class="" id="mergeTbl" border='1'>
<tbody>
<tr >
<td align="center" style="width:100px">A</td>
<td align="center" style="width:100px">1</td>
<td align="center" style="width:100px">12.01 Ct</td>
<td align="center" style="width:100px">3.01</td>
</tr>
<tr>
<td align="center" rowspan="3">B</td>
<td align="center">3</td>
<td align="center">13.02 Ct</td>
<td align="center">4.90</td>
</tr>
<tr>
<td align="center" rowspan="2">4</td>
<td align="center" rowspan="2">11.48 Ct</td>
<td align="center">2.70</td>
</tr><tr>
<td align="center">1.70</td>
</tr>
<tr>
<td align="center" rowspan="3">C</td>
<td align="center">5</td>
<td align="center">16.75 Ct</td>
<td align="center">5.35</td></tr><tr>
<td align="center">6</td>
<td align="center">14.09 Ct</td>
<td align="center">5.01</td></tr>
<tr><td align="center">7</td>
<td align="center">11.35 Ct</td>
<td align="center">4.01</td>
</tr>
</tbody></table>
使用NodeJs库&#39; googleapis&#39;如何获取上述回复的电子邮件地址。我不想使用网址:https://www.googleapis.com/oauth2/v1/userinfo?access_token=your_access_token
答案 0 :(得分:1)
获取introduction中的身份验证对象,然后您可以使用getProfile方法:
function getEmailAddress(auth, callback) {
gmail.users.getProfile({
auth: auth,
userId: 'me'
}, function(err, response) {
if (err) {
console.log('The API returned an error: ' + err);
callback(err, null);
} else {
callback(null, response.emailAddress)
}
});
}