Me pregunto si este tipo de codificación es posible.
Quiero WebScrape desde una página HTML interna. Quiero poder seleccionar una opción en mi página HTML y presionando un botón, quiero WebScrape el código de versión de una aplicación en la parte inferior de esta página "https://play.google.com/store/apps/ detalles?id=org.thoughtcrime.securesms" de Google PlayStore. El formulario HTML es muy 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>Usando 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)mi salida es
['December 3, 2021', 'Varies with device', '50,000,000+', '5.27.13', '4.4 and up', 'Users Interact, Shares Location', 'Signal Foundation']¿Cómo puedo transferir este resultado a mi página HTM? Un valor de Python a HTML