Чтобы арендовать самокат в Гоа, вы можете изучить несколько способов. Вот несколько примеров использования разных языков программирования:
Метод 1: использование Python и Selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
# Set up Chrome driver
driver = webdriver.Chrome()
driver.get("https://www.example.com") # Replace with the actual website URL
# Find and extract the rental information
rental_info = driver.find_element(By.XPATH, "//div[@class='rental-info']")
rental_price = rental_info.find_element(By.CLASS_NAME, "price").text
rental_location = rental_info.find_element(By.CLASS_NAME, "location").text
# Close the browser
driver.quit()
# Print the rental information
print("Rental Price:", rental_price)
print("Rental Location:", rental_location)
Метод 2: использование JavaScript и Puppeteer
const puppeteer = require('puppeteer');
(async () => {
// Launch a new browser instance
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Navigate to the website
await page.goto('https://www.example.com'); // Replace with the actual website URL
// Find and extract the rental information
const rentalPrice = await page.$eval('.price', element => element.textContent);
const rentalLocation = await page.$eval('.location', element => element.textContent);
// Close the browser
await browser.close();
// Print the rental information
console.log('Rental Price:', rentalPrice);
console.log('Rental Location:', rentalLocation);
})();
Метод 3. Использование PHP и cURL
$url = 'https://www.example.com'; // Replace with the actual website URL
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$dom = new DomDocument();
@$dom->loadHTML($response);
$rentalPrice = $dom->getElementById('price')->textContent;
$rentalLocation = $dom->getElementById('location')->textContent;
// Print the rental information
echo 'Rental Price: ' . $rentalPrice . "\n";
echo 'Rental Location: ' . $rentalLocation . "\n";
, '.location', 'price', 'location') в примерах кода с фактической структурой веб-сайта и селекторами, где из которого вы хотите извлечь информацию об аренде.