Last active
November 9, 2023 18:27
-
-
Save vmetnev/4c1f9abe557a0ecbd4591868830d7a13 to your computer and use it in GitHub Desktop.
Working Yahoo Finance
This file contains hidden or 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
getData() | |
async function getData() { | |
let response = await fetch('https://69.147.92.11/v6/finance/quoteSummary/XOM?modules=earningsHistory&ssl=true', { | |
headers: { | |
'Host': 'query2.finance.yahoo.com' | |
} | |
}); | |
let json = await response.json() | |
console.log(json.quoteSummary.result[0].summaryDetail) | |
} | |
This file contains hidden or 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
const fetch = require('node-fetch'); | |
const tunnel = require('tunnel'); | |
// BUY PROXY AT https://proxyline.net/proksi-dlja-ssha/ | |
const proxyUrl = 'http://2YpJr5AY:[email protected]:64616'; | |
const targetUrl = 'https://query2.finance.yahoo.com/v6/finance/quoteSummary/XOM?modules=balanceSheetHistoryQuarterly'; | |
const agent = tunnel.httpsOverHttp({ | |
proxy: { | |
host: '5.1.46.166', | |
port: 64616, | |
proxyAuth: '2YpJr5AY:hF6BeEeZ' | |
} | |
}); | |
async function fetchWithProxy() { | |
try { | |
const response = await fetch(targetUrl, { | |
agent: agent | |
}); | |
if (response.ok) { | |
const responseBody = await response.text(); | |
const data = JSON.parse(responseBody); | |
console.log(JSON.stringify(data, null, 2)); | |
} else { | |
console.error(`Ошибка: ${response.status} - ${response.statusText}`); | |
} | |
} catch (error) { | |
console.error(`Произошла ошибка: ${error}`); | |
} | |
} | |
fetchWithProxy(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment