Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
No se puede acceder a todo el html en pythion-requests-html

Estoy tratando de ejecutar un script para simplemente encontrar algunos números en un sitio web, sin embargo, no parece querer dejarme pasar un cierto punto. En este guión:

 from requests_html import HTMLSession import requests url = "https://auction.chimpers.xyz/" try: s = HTMLSession() r = s.get(url) except requests.exceptions.RequestException as e: print(e) r.html.render(sleep=1) title = r.html.find("title",first=True).text print(title) divs_found = r.html.find("div") print(divs_found) meta_desc = r.html.xpath('//*[@id="description-view"]/div',first=True) print(meta_desc) price = r.html.find(".m-complete-info div",first=True) print(price)

El resultado de esto da:

 Chimpers Genesis 100 [<Element 'div' id='app'>, <Element 'div' data-v-1d311e85='' id='m-connection' class=('manifold',)>, <Element 'div' id='description-view'>, <Element 'div' class=('manifold', 'm-complete-view')>, <Element 'div' data-v-cf8dbfe2='' class=('manifold', 'loading-screen')>, <Element 'div' class=('manifold-logo',)>] <Element 'div' class=('manifold', 'm-complete-view')> None [Finished in 3.9s]

sitio web: https://auction.chimpers.xyz/

y la información que estoy tratando de encontrar está aquí

Claramente, hay más elementos HTML más allá de los que están impresos en la lista, sin embargo, cada vez que intento acceder a ellos, incluso usando r.html.xpath("//*[@id="description-view"]/div/div[2]/div/div[2]/span/span[1]") devolverá Ninguno a pesar de que es el xpath copiado que obtuve a través de la inspección en google

¿Alguna razón por la que esto es y cómo lo haría?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En realidad, no sé si es posible hacerlo con requests_html , pero es con selenium .

 from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.chrome.options import Options url = "https://auction.chimpers.xyz/" class_names = ["m-price-label", "m-price-data"] driver_options = Options() driver_options.add_argument("--headless") driver = webdriver.Chrome(options=driver_options) driver.get(url) results = {} try: for class_name in class_names: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CLASS_NAME, class_name))) # Getting inner text of the html tag results[class_name] = element.get_attribute("textContent") finally: driver.quit() print(results)

Siéntase libre de usar otro controlador web que no sea Chrome

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!