I
I
Insaf Fretch2021-09-18 10:10:23
Python
Insaf Fretch, 2021-09-18 10:10:23

Site parser loadable with js?

Please help me write the site trackadsb.com/VirtualRadar/desktop.html .
I want to get the data inside



I look at the page code, it's empty inside. And in fact there is a list of aircraft.

Here is the code in python

from bs4 import BeautifulSoup
import requests


comps=[]
def parse():
  URL='http://trackadsb.com/VirtualRadar/desktop.html#'
  HEADERS={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'}
  
  response =requests.get(URL, headers=HEADERS)
  soup=BeautifulSoup(response.content, 'html.parser')
  items=soup.find('div', id="aircraftList")
  
  for item in items:
    comps.append(
      item.get_text())

      #for comp in comps:
      #	print(comp[title])
  print(comps)
parse()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-09-18
@ishaimiev

https://qna.habr.com/q/1038438#answer_2008702

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question