Example #1
0
                 Link_URL = x.find('a').get("href")
                 LinkProduct.append(Link_URL)
                 type(Link_URL)             

                #Scrape ProductName
                 NameOfProduct = json.loads(AllProductDeatil)["name"]
                 Productname.append(NameOfProduct)  


                #Scrape ProductPriceCurrent    
                 PriceOfProduct = json.loads(AllProductDeatil)["price"]
                 Productprice.append(PriceOfProduct) 

                #Scrape OldProductPrice         
                 OldProPricesList = x.find('div','product_price_old has_currency_unit')
                 OldProPricesEmp = ff.ConvertNoneToEmp(OldProPricesList)
                 OldProPricesStr = ff.ConvertListToStr(OldProPricesEmp)
                 OldProductPrice.append(OldProPricesStr) 

               #Scrape CategoryProduct
                 ProductCategory_jsonData=json.loads(AllProductDeatil)["category"]
                 CategoryProduct.append(ProductCategory_jsonData) 

               #Scrape Stock    
                 URL_Prefix = urlopen('https://www.arduinothai.com/product/'+str(IDProductLink))
                 SoupStock = BeautifulSoup(URL_Prefix.read(), 'lxml')           
                 ChkStock = SoupStock.find('span', class_='num')
                 Stockemp = ff.ConvertNoneToEmp(ChkStock)
                 Stockstr = ff.ConvertListToStr(Stockemp)
                 StockOfProduct.append(Stockstr)
Example #2
0
                #Scrape OldProductPrice         
                 OldProPricesList = x.find('div','product_price_old has_currency_unit')
                 OldProPricesEmp = ConvertNoneToEmp(OldProPricesList)   
                 OldProPricesStr = ConvertListToStr(OldProPricesEmp)
                 OldProductPrice.append(OldProPricesStr) 

               #Scrape CategoryProduct
                 ProductCategory_jsonData=json.loads(AllProductDeatil)["category"]
                 CategoryProduct.append(ProductCategory_jsonData) 

               #Scrape Stock    
                 URL_Prefix = urlopen('https://www.arduinothai.com/product/'+str(IDProductLink))
                 SoupStock = BeautifulSoup(URL_Prefix.read(), 'lxml')     
                 ChkStock = SoupStock.find('span', class_='num')
                 Stockemp = ff.ConvertNoneToEmp(ChkStock)
                 Stockstr = ff.ConvertListToStr(Stockemp)
                 StockOfProduct.append(Stockstr) 
#ttttt
                 if((ProductCategory_jsonData==('NodeMCU/ESP8266')) or (ProductCategory_jsonData==('ESP32')) or (ProductCategory_jsonData==('Wemos')) 
                     or (ProductCategory_jsonData==('Sonoff/โมดูลเปิดปิดไฟผ่านมือถือ'))):

                     ListOfProduct.append((ProductIDStr, NameOfProduct, PriceOfProduct, OldProPricesStr, ChkStock, Link_URL, ProductCategory_jsonData))

                     data_df = pd.DataFrame({
                            'ProductID': ProductIDAll,
                            'ProdcutName':Productname,
                            'Productprice':Productprice,
                            'OldProductPrice': OldProductPrice,
                            'StockOfProduct': StockOfProduct,
                            'Link': LinkProduct,
Example #3
0
        #Scrape Link URL
        Link_URL = x.find('a').get("href")
        LinkProduct.append(Link_URL)
        type(Link_URL)

        #Scrape ProductName
        NameOfProduct = json.loads(AllProductDeatil)["name"]
        Productname.append(NameOfProduct)

        #Scrape ProductPriceCurrent
        PriceOfProduct = json.loads(AllProductDeatil)["price"]
        Productprice.append(PriceOfProduct)

        #Scrape OldProductPrice
        OldProPricesList = x.find('div', 'product_price_old has_currency_unit')
        OldProPricesEmp = ff.ConvertNoneToEmp(OldProPricesList)
        OldProPricesStr = ff.ConvertListToStr(OldProPricesEmp)
        OldProductPrice.append(OldProPricesStr)

        #Scrape CategoryProduct
        ProductCategory_jsonData = json.loads(AllProductDeatil)["category"]
        CategoryProduct.append(ProductCategory_jsonData)

        #Scrape Stock
        URL_Prefix = urlopen('https://www.arduinothai.com/product/' +
                             str(IDProductLink))
        SoupStock = BeautifulSoup(URL_Prefix.read(), 'lxml')
        ChkStock = SoupStock.find('span', class_='num')
        Stockemp = ConvertNoneToEmp(ChkStock)
        Stockstr = ConvertListToStr(Stockemp)
        StockOfProduct.append(Stockstr)