I’m wondering if this kind of coding is possible.
I want to WebScrape from an in-house HTML page. I want to be able to select an option in my HTML page and by pushing a button, I want to WebScrape the version code of an application in the bottom of this page “https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms” from Google PlayStore. The HTML form is very simple.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<hr>
<label for="cars">Applikation:</label>
<select name="apps" id="SelectApps">
<option value="Tom">Tom</option>
<option value="Signal">Signal</option>
<option value="WhatsApp">WhatsApp</option>
</select>
<button type="button" id="myBtn" onclick="myFunction()">Hent data</button>
<hr>
<form id="myForm" action="xxxxxx">
ID : <input id="ID1" type="text" value="ID"><br>
Version : <input id="ID2" type="text" value="Version"><br>
</form>
<hr>
<script>
function myFunction() {
if(document.getElementById('SelectApps').value == "Signal") {
ID1.value = 'org.thoughtcrime.securesms';
ID2.value = webscrape from google store
}
}
</script>
</body>
</html>
By using Python xxx
from lxml import html
import requests
import os
page = requests.get('https://play.google.com/store/apps/details?
id=org.thoughtcrime.securesms')
tree = html.fromstring(page.content)
version = tree.xpath('//span[@class="htlgb"]/text()')
print('Data: ', version)
My output is
['December 3, 2021', 'Varies with device', '50,000,000+', '5.27.13', '4.4 and up',
'Users Interact, Shares Location', 'Signal Foundation']
How can I transfer this output into my HTM page? A value from Python into HTML