Oct-09-2020, 03:29 PM
498/5000
Hi, this is the first time that I write so I apologize in advance if I have the wrong section in the forum.
In the last few days I wanted to understand how a telegram bot works and I discovered that I have to use the Python language. What I want to do is very simple, create a bot that alerts me when on an internet page, there are values (such as the price of a product) set by me (such as bots for offers). After doing my internet research I came to a point in the code:
Thank you so much in advance for your understanding and help.
Hi, this is the first time that I write so I apologize in advance if I have the wrong section in the forum.
In the last few days I wanted to understand how a telegram bot works and I discovered that I have to use the Python language. What I want to do is very simple, create a bot that alerts me when on an internet page, there are values (such as the price of a product) set by me (such as bots for offers). After doing my internet research I came to a point in the code:
import requests import json from bs4 import BeautifulSoup BASE_URL = 'https://www.ninjabet.it/oddsmatcher-free' TOKEN = '1210796154:XXXXXXXXXXXXXXXXXXXXXXXXXx' CHAT_ID = 'XXXXXXXX' TELEGRAM_API_SEND_MSG = f'https://api.telegram.org/bot{TOKEN}/sendMessage' headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'} requests.get('https://www.ninjabet.it/login', auth=('[email protected]', 'XXXXXXXXXX')) r=requests.get('https://www.ninjabet.it/oddsmatcher-free',headers=headers) soup = BeautifulSoup(r.text,'html.parser') print(soup)Inside soup what I am looking for is the rating but it is not expressed as a given, and therefore readable with Beautifulsoup, but it is saved in:
var json.ratingand
var json = allData.dataand
var allData = jQuery.parseJSON(data)Checking the AJAX I noticed that there is a PHP file "get_data.php" accessible from "https://www.ninjabet.it/get_data.php" which contains "rating", the data I am looking for. How can I import the server response into Phyton?
Thank you so much in advance for your understanding and help.
