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

112
Views
How to retrieve a variable from a website while JavaScript updates it

I need to save a variable from a website.

On the left there is the website page where the value I need to save (peak_ch1) is indicated, on the right there is the corresponding htlm code.

The variable is defined in Javascript with the following code:

result = ...

$('#peak_ch1').val(result);

With the following Python code:

import requests
from bs4 import BeautifulSoup

url= ...
  
#open with GET method
resp=requests.get(url)
  
#http_respone 200 means OK status
if resp.status_code==200:
    print("Successfully opened the web page")
    print("The news are as follow :-\n")
  
    # we need a parser,Python built-in HTML parser is enough .
    soup=BeautifulSoup(resp.text,'html.parser')    

    # l is the list which contains all the text i.e news 
    l=soup.find("input",{"id":"peak_ch1"})
    print(l)
  
    #now we want to print only the text part of the anchor.
    #find all the elements of a, i.e anchor
    for i in l.findAll("a"):
        print(i.text)
else:
    print("Error")

It prints:

<input class="setfield setfield_info" id="peak_ch1" name="peak_ch1" readonly="" style="margin-top: 5px;" type="text" value="0"/>

But I need the value that is updated by js. How is it possible to retrieve the value?

about 4 years ago · Santiago Trujillo
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!