def scrape_shoes(key):
    url = URLS.get(key)
    response = (requests.get(url, timeout=5))
    soup = BeautifulSoup(response.content, "html.parser")
    table = soup.find_all("table", {"class": "roundy"})
    items = {}
    for tableNumber in range(2, 8):
        for tr in table[tableNumber].find_all("tr")[2:]:
            name = tr.find_all("td")[0].text.strip()
            item = {
                "name":
                name,
                # "imageLink": tr.find_all("td")[1].find_all("a")[0]["href"],
                "priceBuy":
                parse_price(tr.find_all("td")[2].text),
                "priceSell":
                parse_price(tr.find_all("td")[3].text),
                "source":
                parse_source(tr.find_all("td")[4]),
                "variations":
                parse_variations(tr.find_all("td")[5]),
                "variationImageLinks":
                get_image_urls(tr.find_all("td")[5].find_all("img"))
            }
            if tr.find_all("td")[1].find_all("a"):
                item["imageLink"] = tr.find_all("td")[1].find_all(
                    "a")[0]["href"]
            items[name] = item
    dump_data(items, "clothing/" + key)
    return items
Beispiel #2
0
def get_reddit_wallpaper():
    subreddit_str = str(subreddit.get())
    post_num_int = int(post_num.get())

    wallpaper_subreddit = util.get_subreddit(subreddit_str)
    if post_type_selection.get() == 'hot':
        posts = util.get_hot_posts(wallpaper_subreddit, post_num_int)
    else:
        posts = util.get_top_posts(wallpaper_subreddit, post_num_int)

    image_urls = util.get_image_urls(posts)
    image_url = image_urls[randint(0, len(image_urls) - 1)]
    image_file_path = util.download_image_url(image_url, subreddit_str)
    util.set_windows_desktop_background(image_file_path)