Last active
January 18, 2024 12:17
-
-
Save nmaruy27/679a47ad6ae07245f957d7d026e8f5d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getStockValue(stockCode) { | |
var code = String(stockCode).split(',')[0]; | |
var url = 'https://xxxxxx.com/'; | |
var res = UrlFetchApp.fetch(url + code); | |
if(res.getResponseCode() == 200) { | |
var value = Parser.data(res.getContentText()).from('<div class="stock_price">').to('<span class="decimal">').build(); | |
return value.trim().replace('.', ''); | |
} else { | |
return '取得失敗'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment