def test_Cettire(self): url = "https://www.cettire.com/collections/ss20-sale/products/valentino-side-stripe-pants-93191167" retailer = Cettire(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Ssense(self): url = "https://www.ssense.com/ja-us/women/product/balenciaga/pink-baguette-bag/5116701" retailer = Ssense(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Coggles(self): url = "https://www.coggles.com/bags-clothing-women-accessories/by-far-women-s-amber-snake-print-bag-snake-print/12490621.html" retailer = Coggles(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Articture(self): url = "https://articture.com/collections/best-sellers/products/light-of-life?variant=23168128843834" retailer = Articture(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Forzieri(self): url = "https://www.jp.forzieri.com/jpn/product_view.asp?l=jpn&c=jpn&pkb=1&dept_id=18&sku=mx130620-018-00" retailer = Forzieri(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Raffaellonetwork(self): url = "https://www.raffaello-network.com/japanese/fashion-detail/569101/28/%E3%83%97%E3%83%A9%E3%83%80%20%E3%83%A1%E3%83%B3%E3%82%BA%E3%80%80%E3%82%B7%E3%83%A5%E3%83%BC%E3%82%BA.html" retailer = Raffaellonetwork(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Shopbop(self): url = "https://www.shopbop.com/emma-dress-rixo/vp/v=1/1587287985.htm?folderID=13594&fm=other-shopbysize-viewall&os=false&colorId=182D2&ref_=SB_PLP_EP_1" retailer = Shopbop(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Farfetch(self): url = "https://www.farfetch.com/jp/shopping/women/jil-sander--item-14829276.aspx?storeid=9359" retailer = Farfetch(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Vitkac(self): url = "https://www.vitkac.com/us/p/training-sneakers-ea7-emporio-armani-shoes-1081759" retailer = Vitkac(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test__24scom(self): url = "https://www.24s.com/en-jp/zoom-x-vista-grind-trainers-nike_NIK7ENKP?defaultSku=NIK7ENKPBLUNI08500&color=fossil-stone-sail-hyper-blue" retailer = _24scom(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Nugnes1920(self): url = "https://us.nugnes1920.com/collections/sale-man/products/lardini_jacket_blue_eiljm56ei54000-850" retailer = Nugnes1920(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Ruelala(self): url = "https://www.ruelala.com/boutique/product/159083/100976374/?dsi=BTQ--3789916f-f5d9-4482-8035-829886aedae5&lsi=146e8ffd-6e44-4657-a80e-262984805ab1&pos=1" retailer = Ruelala(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Biffi(self): url = "https://www.biffi.com/it_it/sandali-bv-board-item-000258750038277.html" retailer = Biffi(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Mytheresa(self): url = "https://www.mytheresa.com/en-jp/valentino-wool-blend-crepe-dress-1363812.html?catref=category" retailer = Mytheresa(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0])
def test_Harveynichols(self): try: url = "https://www.harveynichols.com/int/brand/tl-180/379088-le-fazzoletto-snake-effect-top-handle-bag/p3747340/" retailer = Harveynichols(url) c = Client(retailer) c.search() data, columns = c.collect() self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except: c.channel.driver.screenshot("/tmp/Harvey.png")
def test_Tessabit(self): try: url = "https://www.tessabit.com/jp/woman-fendi-jackets-belted-jacket-847587295/" retailer = Tessabit(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except: c.channel.driver.screenshot("/tmp/Tessabit.png")
def test_Saksoff5th(self): try: url = "https://www.saksoff5th.com/product/marcus-adler-printed-2-piece-bandana-mask-set-0400012781189.html?dwvar_0400012781189_color=RED_BLUE" retailer = Saksoff5th(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except: c.channel.driver.screenshot("/tmp/Saksfifthavenue.png")
def test_Saksfifthavenue(self): try: url = "https://www.saksfifthavenue.com/3-1-phillip-lim-drum-leather-ankle-boots/product/0400099230689?R=888824640622&P_name=3.1+Phillip+Lim&N=1553" retailer = Saksfifthavenue(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except: c.channel.driver.screenshot("/tmp/Saksfifthavenue.png")
def test_Gilt(self): try: url = "https://www.gilt.jp/sales/114191467/looks/114361585?size=38" retailer = Gilt(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except: c.channel.driver.screenshot("/tmp/Gilt.png")
def test_Matchesfashion(self): try: url = "https://www.matchesfashion.com/en-jp/products/Paul-Smith-Leather-bi-fold-wallet-1241440" retailer = Matchesfashion(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except: c.channel.driver.screenshot("/tmp/Matches.png")
def test_Modaoperandi(self): try: url = "https://www.modaoperandi.com/jil-sander-fw20/grande-tangle-leather-tote?size=OS" retailer = Modaoperandi(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except: c.channel.driver.screenshot("/tmp/Modaoperand.png")
def test_Luisaviaroma(self): try: url = "https://www.luisaviaroma.com/ja-jp/p/neil-barrett/%E3%83%A1%E3%83%B3%E3%82%BA/%E3%82%B7%E3%83%A7%E3%83%BC%E3%83%88%E3%83%91%E3%83%B3%E3%83%84/71I-05I009?ColorId=NTI00&SubLine=clothing&CategoryId=109&lvrid=_p_d106_gm_c109" retailer = Luisaviaroma(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except: c.channel.driver.screenshot("/tmp/Luisa.png")
def test_Danielloboutique(self): try: url = "https://www.danielloboutique.it/jp/catalog/product/view/id/93802/s/4263943/category/314/" retailer = Danielloboutique(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except: c.channel.driver.screenshot("/tmp/Danielloboutique.png")
def test_Yoox(self): try: url = "https://www.yoox.com/uk/11841342EJ/item#dept=newarrivalswomen&sts=SearchResult&cod10=11841342EJ&sizeId=&sizeName=" retailer = Yoox(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except Exception as e: print(e.args[0]) c.channel.driver.screenshot("/tmp/Yoox.png")
def test_Dolcegabbana(self): try: url = "https://www.dolcegabbana.com/ja/%E3%83%AC%E3%83%87%E3%82%A3%E3%83%BC%E3%82%B9/%E3%83%90%E3%83%83%E3%82%B0/%E3%83%90%E3%83%83%E3%82%AF%E3%83%91%E3%83%83%E3%82%AFand%E3%82%A6%E3%82%A8%E3%82%B9%E3%83%88%E3%83%9D%E3%83%BC%E3%83%81/devotion-%E3%82%A6%E3%82%A8%E3%82%B9%E3%83%88%E3%83%9D%E3%83%BC%E3%83%81-%E3%83%A2%E3%83%AB%E3%83%89%E3%83%AC-%E3%83%8A%E3%83%83%E3%83%91%E3%83%AC%E3%82%B6%E3%83%BC-%E3%83%95%E3%83%A5%E3%83%BC%E3%82%B7%E3%83%A3-BB6706A10168H461.html" retailer = Dolcegabbana(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except Exception as e: print(e.args[0]) c.channel.driver.screenshot("/tmp/Dolcegabbana.png")
def test_Theluxurycloset(self): try: url = "https://theluxurycloset.com/women/celine-grey-leather-and-suede-large-trapeze-bag-p228423" retailer = Theluxurycloset(url) c = Client(retailer) c.search() data, columns = c.collect() # print(data) self.assertIsInstance(data, dict) self.assertNotIn(None, data[0]) except Exception as e: print(e.args[0]) c.channel.driver.screenshot("/tmp/Theluxurycloset.png")
def articture(event, context): keywords = event["keywords"] print(f"*** This is articture, {keywords} ***") """ Pt.1 Articture の検索結果一覧を取得 """ artic = Art() c = Client(artic) data_dict = {} while c.channel.next_page is not None: c.search(keywords=keywords) data, columns = c.collect() data_dict.update(data) path = "~/Desktop/%s&%s.collected.csv" % ( c.channel.name, "+".join(keywords), ) df_curator = c.to_df(data=data_dict, columns=columns, save=path) # keywords = ["FURLA"] # path = "~/Desktop/articture.com&light.collected.csv" # df_curator = pd.read_csv(path) print(df_curator.head()) """ Pt.2 取得先の href リンク先から必要情報を取得 """ data_dict = {} for index, row in df_curator.iterrows(): try: retailer = Articture(row["href"]) c = Client(retailer) c.search() data, columns = c.collect() try: data_dict[index] = data[0] except KeyError: data_dict[index] = [None for c in columns] except Exception as e: print("...Exception Occured...", index, row["title"]) print(e.args[0]) data_dict[index] = [None for c in columns] path = "~/Desktop/%s&%s.retailer.csv" % ( c.channel.name, "+".join(keywords), ) df_retailer = c.to_df(data=data_dict, columns=columns, save=path) """ Pt.3 キュレーターとリテーラーを結合 """ path = "~/Desktop/%s&%s.curator-retailer.csv" % ( c.channel.name, "+".join(keywords), ) df2 = pd.concat([df_curator, df_retailer], axis=1) df2.to_csv(path) # df2 = pd.read_csv(path) df2 = df2.dropna() """ Pt.4 BUYMA で価格チェック(出品がないためスキップ) """ ptn = r".+[^\-A-Z0-9]([\-A-Z0-9]+$)" active_dict = {} for index, row in df2.iterrows(): # SKU を検索ワードに設定 # sku = re.sub(ptn, r"\1", row["retailer_sku"]) cheapest_price = row["retailer_price"] cheapest_price = exchange_currency(cheapest_price) active_dict[index] = [1, cheapest_price] # 全て アクティブ 1 に設定 path = "~/Desktop/%s&%s.malls.csv" % ( c.channel.name, "+".join(keywords), ) mall_df = c.to_df(data=active_dict, columns=["active", "active_price"], save=path) """ Pt.5 リサーチ結果を結合し、1 のものだけをフィルター """ df3 = pd.concat([df2, mall_df], axis=1) active_df = df3[df3["active"] == 1] path = "~/Desktop/%s&%s.researched.csv" % ( c.channel.name, "+".join(keywords), ) active_df.to_csv(path) return True
def lyst(event, context): keywords = event["keywords"] discount_rate = event["discount_rate"] print(f"*** This is lyst, {keywords}, {discount_rate} ***") """ Pt.1 Lyst から検索ワード一覧を取得 """ lyst = Lyst() c = Client(lyst) c.search(keywords=keywords, discount_rate=discount_rate) data, columns = c.collect() path = "~/Desktop/%s&%s.collected.csv" % ( c.channel.name, "+".join(keywords), ) df_curator = c.to_df(data=data, columns=columns, save=path) # path = "~/Desktop/Lyst.com&celine+bag.collected.csv" # df_curator = pd.read_csv(path) print(df_curator.head()) """ Pt.2 取得先のリテーラーから必要情報を取得 """ data_dict = {} for index, row in df_curator.iterrows(): try: retailer_name = exchange_retailer_name(row["retailer"]) if retailer_name in RETAILER_NAMES: retailer = globals()[retailer_name](row["href"]) c = Client(retailer) c.search() data, columns = c.collect() try: data_dict[index] = data[0] except KeyError: data_dict[index] = [None for c in columns] except Exception as e: print("...Exception Occured...", index, row["title"]) print(e.args[0]) data_dict[index] = [None for c in columns] path = "~/Desktop/%s&%s.retailer.csv" % ( c.channel.name, "+".join(keywords), ) df_retailer = c.to_df(data=data_dict, columns=columns, save=path) """ Pt.3 キュレーターとリテーラーを結合 """ path = "~/Desktop/%s&%s.curator-retailer.csv" % ( c.channel.name, "+".join(keywords), ) df2 = pd.concat([df_curator, df_retailer], axis=1) df2.to_csv(path) # df2 = pd.read_csv(path) df2 = df2.dropna() """ Pt.4 BUYMA で価格チェック """ buymaItems = BuymaItems() ptn = r".+[^\-A-Z0-9]([\-A-Z0-9]+$)" active_dict = {} for index, row in df2.iterrows(): # SKU を検索ワードに設定 sku = re.sub(ptn, r"\1", row["retailer_sku"]) cheapest_price = row["retailer_price"] if any( row["retailer_price"] ) else "9999999999" # if "通貨" があるので str 型にしておく cheapest_price = exchange_currency(cheapest_price) c = Client(buymaItems) c.search(keywords=[sku]) data, columns = c.collect() prices = [v for k, values in data.items() for v in values] active_dict[index] = [ BuymaItems.compare(cheapest_price, prices), cheapest_price ] path = "~/Desktop/%s&%s.malls.csv" % ( c.channel.name, "+".join(keywords), ) mall_df = c.to_df(data=active_dict, columns=["active", "active_price"], save=path) """ Pt.5 リサーチ結果を結合し、1 のものだけをフィルター """ df3 = pd.concat([df2, mall_df], axis=1) active_df = df3[df3["active"] == 1] path = "~/Desktop/%s&%s.researched.csv" % ( c.channel.name, "+".join(keywords), ) active_df.to_csv(path) return True