Issue
I want to scrap data from this web page
I want to get all the blogs...which are under result tag (<div class="results">)
In browser tools there it is showing under result tag there are 10 snippets...
But using Beautifulsoap I am getting
<div class="results">
</div>
and in postman getting same thing..
This is the way I am doing..
topicuri = "\"
r = s.get(topicuri)
soup = BeautifulSoup(r.text, 'html.parser')
pages = soup.find('div', {'class': 'results'})
print(pages)
Solution
You also can get data from api calls json response
import requests
import json
body= "vodafone"
headers= {
'content-type': 'application/json'
}
api_url = "https://search.donanimhaber.com/api/search/portal/?q=vodafone&p=3&devicetype=browsermobile&order=date_desc&in=all&contenttype=all&wordtype=both&daterange=all"
jsonData = requests.post(api_url, data=json.dumps(body), headers=headers).json()
for item in jsonData['contents']:
categoryName=item['categoryName']
print(categoryName)
Output:
Operatörler - Kurumsal Haberler
Operatörler - Kurumsal Haberler
Operatörler - Kurumsal Haberler
Mobil Aksesuarlar
Operatörler - Kurumsal Haberler
Kripto Para
Sinema ve Dizi
Mobil Oyunlar
Operatörler - Kurumsal Haberler
Operatörler - Kurumsal Haberler
Answered By - F.Hoque
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.