-2

我正在尝试刮掉这双鞋的鞋码。https://www.mirapodo.de/tommy-hilfiger-gummistiefel-cognac-4545847.html。我怎样才能刮价值。

   <div class="grid-gap__m prod-info__size js-pdp-size">
                <form action="#">
          <div class="select-container prod-info__size-select-container  w100 ">
            <select class="ProdSizeSelect js-prod-variant-select" data-layer="js-layer-add-to-cart" name="selectsize" data-action="select-list" data-selected-sku="selectedSku" data-group-sku="4545847">
              <option value="select" data-add-to-notepad="allowed" selected="selected" data-disabled="disabled" disabled> Größe wählen</option>
                              <option value="4545848" data-add-to-notepad="allowed">36 (EU)</option>
                              <option value="4545849" data-add-to-notepad="allowed" data-offline="true" data-disabled="disabled">37 (EU) - Ausverkauft</option>
                              <option value="4545850" data-add-to-notepad="allowed">38 (EU)</option>
                              <option value="4545851" data-add-to-notepad="allowed" data-disabled="disabled">39 (EU) - Ausverkauft</option>
                              <option value="4545852" data-add-to-notepad="allowed" data-offline="true" data-disabled="disabled">40 (EU) - Ausverkauft</option>
                              <option value="4545853" data-add-to-notepad="allowed" data-disabled="disabled">41 (EU) - Ausverkauft</option>
                              <option value="4545854" data-add-to-notepad="allowed">42 (EU)</option>
                          </select>
          </div>
        </form>
      </div>
4

2 回答 2

0
from os import link, name
from os import system
import os
import requests
import json
from datetime import timedelta
from datetime import datetime
import csv
import time
from bs4 import BeautifulSoup as soup
from requests.models import ReadTimeoutError, Response
import colorama
from colorama import Fore, Back, Style
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from discord_webhook import DiscordWebhook, DiscordEmbed
from bs4 import BeautifulSoup as bs
import threading
import concurrent.futures


session = requests.session()

r = session.get("https://www.mirapodo.de/tommy-hilfiger-gummistiefel-cognac-4545847.html")

def get_sizes_instock():
    
    soup = bs(r, 'lxml')
    productscraper = soup.find('div',{'class':"ProdSizeSelect js-prod-variant-select"})
    allsizes = productscraper.find("value").text
    producttext = productscraper
    print(producttext)
于 2021-12-28T11:33:43.660 回答
0
from pprint import pp

import requests
from bs4 import BeautifulSoup


def main(url):
    r = requests.get(url)
    soup = BeautifulSoup(r.text, 'lxml')
    sizes = [x.text for x in soup.select(
        '.ProdSizeSelect option:nth-child(n+2)')]
    pp(sizes)


main('https://www.mirapodo.de/tommy-hilfiger-gummistiefel-cognac-4545847.html')

输出:

['36 (EU)',
 '37 (EU) - Ausverkauft',
 '38 (EU)',
 '39 (EU) - Ausverkauft',
 '40 (EU) - Ausverkauft',
 '41 (EU) - Ausverkauft',
 '42 (EU)']
于 2021-12-28T11:36:42.727 回答