I have a link : https://www.cagematch.net/?id=2&nr=448&gimmick=Adam+Pearce
In this link there data in divs with same class name. But I want to fetch specifi div. Like I want to fetch current gimmik then age and brand nothing else. I tried this code :
url = "http://www.cagematch.net/?id=8&nr=1&page=15"
headers = {"Accept-Encoding": "deflate"}
soup = BeautifulSoup(requests.get(url, headers=headers).content, "html.parser")links = ["https://www.cagematch.net/" + a["href"] for a in soup.select(".TCol a")
]
list = []
for u in links:soup = BeautifulSoup(requests.get(u, headers=headers).content, "html.parser")# print(soup.h1.text)with open("wwe/maw.csv", 'a', encoding="utf-8", newline="") as f:wrt = writer(f)for info in soup.select_all(".InformationBoxRow"):# header1 = info.select_one(".InformationBoxTitle").text# header2 = info.select_one(".InformationBoxContents").text# table = [header1, header2, "/"]header1 = info.select("div", class_="InformationBoxContents").textprint(header1)
With this I am getting all the data from that page. But I want to fetch only some of them. How can I get that. Is there any easy way to do it?