STORY
Я пытаюсь создать бота pewdiepie vs T-series, который будет чирикать текущий субсчет с API YouTube на аккаунт в Твиттере каждый час.Я новичок в программировании, и теперь я хочу знать, как я могу получить этот html-объект субсчета и передать его как переменную в моем js-файле, чтобы я мог твитовать субсчет вместо того, чтобы размещать его только на веб-странице.если это имеет смысл?
1006 *
ЧТО ИМ ИСПОЛЬЗОВАНИЕ HTML веб-страницы 1025 *![This the Full Html Page when ran with live server on vs code](https://i.stack.imgur.com/PnyfF.png)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta http-equiv="X-UA-Compatible"content="ie=edge">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/ materialize/1.0.0-rc.2
/css/materialize.min.css">
<title>SUBSCRIBE TO PEWDIEPIE!</title>
</head>
<body>
<nav class="black">
<div clsss="nav-wrapper">
<div class="container">
<a href="#!" class="brand-logo">SUBSCRIBE TO PEWDIEPIE</a>
</div>
</div>
</nav>
<br>
<section>
<div class="container">
<div class="left w50">
<br>
<div id="content_pewds">
<div class="row">
<div class="col s6">
<form id="channel_form">
<div class="input-field">
<h1>PEWDIEPIE</h1>
<h3>Current Subscribers</h3>
<h1 id="yt-countPewds"></h1>
<script>
function getJSON(response) {
var subCount =
response.items[0].statistics.subscriberCount;
document.getElementById('yt-countPewds').innerHTML = subCount;
}
</script>
<script src="https://www.googleapis.com/youtube/v3/channelspart=statistics&id=UC-lHJZR3Gqxm24_Vd_AJ5Yw&key=keyc&callback=getJSON"></script>
<button id="subBtn" class="btn red lighten ">SUBSCRIBE</button>
</div>
</form>
</div>
<div id="channel_data" class="col s6"></div>
</div>
<div class="row" id="video_container"></div>
</div>
</div>
</section>
</div>
и это мой файл JS Bot
//Twit Package
var Twit = require('twit');
// Twit API Keys Imported From config.js File
var config = require('./config');
// Twit Package Keys Object
var T = new Twit(config)
setInterval(tweetIt, 1000*10)
//so this is what i would like to acomplish with the program
tweetIt('pewds: '+ pewdsTotalSubs + 'tseries: '+ tseriesTotalSubs)
function tweetIt(txt){
var tweet = {
status: txt
}
T.post('statuses/update', tweet, tweeted);
function tweeted(err, data, response) {
if (err) {
console.log("Something Went Wrong!")
} else {
console.log("It Worked!")
}
}
}