def main(store): offers = [] store_id = sql.get_store_id(store["name"])[0] category_id = sql.get_category_id(store["category"])[0] print(f'\n{store["name"]}:\n') urls = store["urls"] for url in urls: html = get_html(url) num_pages = get_num_pages(html, store) for page in range(num_pages): if page > 0: page_url = f"{url}{page + 1}" html = get_html(page_url) articles = html.find_all(store["articles_find"][0], class_=store["articles_find"][1]) for article in articles: regular_price = get_regular_price(article, store) if not regular_price: continue article_name = get_article_name(article, store) sale_price = get_sale_price(article, store) website_article_id = get_website_article_id(article, store) img_url = get_img_url(article, store) offer = Article(0, store_id, category_id, website_article_id, article_name, regular_price, sale_price, img_url) offer.print_offer() offers.append(offer) return store_id, offers
def main(): offers_oculus_stores = [] oculus_stores = ["Oculus Quest", "Oculus Rift", "Oculus Go"] category_id = sql.get_category_id("software")[0] for oculus_store in oculus_stores: store = sql.get_store_id(oculus_store) offers_oculus_stores.append(get_oculus_offers(store, category_id)) return offers_oculus_stores
def main(): offers = [] store = { "soup_find": ("div", "article-list-item clearfix"), "article_name_find": ("a", "product_link"), "sale_price_find": ("span", "gm_price"), "available_find": ("dd", "ai_shipping_time") } store_id, _, url = sql.get_store_id("Netgames") print("\nNetgames:\n") html = requests.get(url).text soup = BeautifulSoup(html, 'lxml') soup = soup.find_all(store["soup_find"][0], class_=store["soup_find"][1]) for article in soup: available = check_availability(article, store) if not available: continue article_name = article.find(store["article_name_find"][0], class_=store["article_name_find"][1]).text vr_article = check_keywords(article_name) if not vr_article: continue sale_price = get_sale_price(article, store) category_id, article_name, regular_price = vr_article if regular_price > sale_price > regular_price - regular_price / 3: website_article_id = get_website_article_id(article) img_url = get_img_url(article) offer = Article( 0, store_id, category_id, website_article_id, article_name, regular_price, sale_price, img_url, ) offer.print_offer() offers.append(offer) return store_id, offers
def main(): print("\nSaturn:\n") store_id = sql.get_store_id("Saturn")[0] offers = get_offers(store_id) return store_id, offers
def main(): print("\nAmazon:\n") store_id = sql.get_store_id("Amazon")[0] offers = get_amazon_offers(store_id) return store_id, offers
def main(): print("\nMediamarkt:\n") store_id = sql.get_store_id("Mediamarkt")[0] offers = get_offers(store_id) return store_id, offers
def main(): print("\nHumble Bundle:\n") store_id = sql.get_store_id("Humble Bundle")[0] category_id = sql.get_category_id("software")[0] offers = get_offers(store_id, category_id) return store_id, offers
def main(): print("\nSteam VR:\n") store_id = sql.get_store_id("Steam")[0] category_id = sql.get_category_id("software")[0] offers = get_steam_offers(store_id, category_id) return store_id, offers