Connect python script to node js using pythonshell package in node js

I created a python program to scrape content from wikipedia page. I want to display this scraped data on localserver with node js server using express node js having pythonshell package. This is my code for Wiki.py(python program that i want to print on local host) and start.js(node js program to upload on local server) but it prints on terminal only but doesnot send any data to local host. Task is to do in this manner specifically.

Wiki.py Code:

from bs4 import BeautifulSoup
import requests

source = requests.get('https://en.wikipedia.org/wiki/Will_Smith').text
soup = BeautifulSoup(source,'html.parser')

heading = soup.find('h1',{'id':'firstHeading'}).text
print(heading)
print()

for item in soup.select("#mw-content-text"):
    required_data = [p_item.text for p_item in item.select("p")][3:6]
    print('\n'.join(required_data))

Start.js: Node js code:

const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
  var myPythonScriptPath = 'Wiki1.py';
  const {PythonShell} = require("python-shell");
  var pyshell = new PythonShell(myPythonScriptPath);

  pyshell.on('message', function (message) {
    console.log(message);
});
})
app.listen(port, () => console.log(`Example app listening on port 
${port}!`))

https://adevait.com/nodejs/top-6-nodejs-developer-skills

Thanks.

Hi @hays88266,

I have not tried this before. I will try this out on weekends and let you know.