Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
Jobreceive.com for sale
Blogerwiki
Updated:
Yesterday at 8:55 PM
Post Your Vehicle for Sale — FREE! - https://libro.lk
Kalu_Puth
Updated:
Yesterday at 7:38 PM
ඔයාගෙ Assignment හෝ Thesis එක හරියට හදාගමු
ErMurazor
Updated:
Saturday at 10:52 PM
Ad icon
BlackWall V2ray servers
hu KANNA
Updated:
Sep 23, 2026
Peppa Pig Family Plush Toy Set – 5 Characters
anil1961
Updated:
Sep 19, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
UoM Online Course 3 - Python Programming එක ඉවර කරපු අය...
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="SL MULTIMEDIA TUTORIAL" data-source="post: 27635803" data-attributes="member: 575597"><p>menna mage Code eka meke Error eka mokakda <img class="smilie smilie--emoji" loading="lazy" alt="🥲" title="Smiling face with tear :smiling_face_with_tear:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f972.png" data-shortname=":smiling_face_with_tear:" /> <img src="/styles/default/xenforo/smilies/default/sorry.gif" class="smilie" loading="lazy" alt=":sorry:" title="Sorry :sorry:" data-shortname=":sorry:" /></p><p></p><p>[CODE=python]</p><p>import requests</p><p>import json</p><p></p><p>import sys</p><p>sys.path.insert(0,'bs4.zip')</p><p>from bs4 import BeautifulSoup</p><p></p><p>#Imitate the Mozilla</p><p>user_agent = {'User-agent': 'Mozilla/5.0'}</p><p></p><p></p><p></p><p>def compare_prices(product_laughs,product_glomark):</p><p></p><p></p><p> # laugfs product</p><p> html_laugfs = requests.get(product_laughs).content</p><p> soup_laugfs = BeautifulSoup(html_laugfs, 'html.parser')</p><p></p><p> prod_laugfs = soup_laugfs.find('span',class_="regular-price")</p><p></p><p> prodName = soup_laugfs.find('div',class_="product-name")</p><p> product_name_laughs=prodName.get_text()</p><p></p><p> prod_laugfs = prod_laugfs.get_text() # Will get text from html tags</p><p> product_laugfs = prod_laugfs.strip() # Removing special characters like \n (newline)</p><p> #print(product_name_laughs)</p><p> prod_price_laugfs = product_laugfs[3:]</p><p> price_laughs = float(prod_price_laugfs)</p><p> #print(price_laughs)</p><p></p><p> # Glomark product</p><p></p><p> html_glomark = requests.get(product_glomark).content</p><p> soup_glomark = BeautifulSoup(html_glomark, 'html.parser')</p><p></p><p> prod_glomark = soup_glomark.find('script',type="application/ld+json")</p><p> prod_glomark = prod_glomark.get_text()</p><p> prod_glomark = json.loads(prod_glomark)</p><p></p><p> product_name_glomark = prod_glomark['description']</p><p> offers_glomark = prod_glomark['offers'][0]</p><p> price_glomark = float(offers_glomark['price'])</p><p> #print(product_name_glomark)</p><p> #print(price_glomark)</p><p></p><p> </p><p> print('Laughs ',product_name_laughs,'Rs.: ' , price_laughs)</p><p> print('Glomark ',product_name_glomark,'Rs.: ' , price_glomark)</p><p> </p><p> if(price_laughs>price_glomark):</p><p> print('Glomark is cheaper Rs.:',price_laughs - price_glomark)</p><p> elif(price_laughs<price_glomark):</p><p> print('Laughs is cheaper Rs.:',price_glomark - price_laughs) </p><p> else:</p><p> print('Price is the same')</p><p></p><p></p><p>laughs_coconut = 'https://scrape-sm1.github.io/site1/COCONUT%20market1super.html'</p><p>glomark_coconut = 'https://glomark.lk/coconut/p/11624'</p><p></p><p>laughs_tissues = 'https://www.laugfssuper.com/index.php/categories/household/flora-facial-tissues-2-x-160-box.html'</p><p>glomark_tissues = 'https://glomark.lk/flora-facial-tissues-160s/p/10470'</p><p></p><p>laughs_bread = 'https://www.laugfssuper.com/index.php/crimson-bread-sliced-111452.html'</p><p>glomark_bread = 'https://glomark.lk/top-crust-bread/p/13676'</p><p></p><p>#compare_prices(laughs_coconut,glomark_coconut)</p><p></p><p>compare_prices(laughs_bread,glomark_bread)[/CODE]</p></blockquote><p></p>
[QUOTE="SL MULTIMEDIA TUTORIAL, post: 27635803, member: 575597"] menna mage Code eka meke Error eka mokakda 🥲 :sorry: [CODE=python] import requests import json import sys sys.path.insert(0,'bs4.zip') from bs4 import BeautifulSoup #Imitate the Mozilla user_agent = {'User-agent': 'Mozilla/5.0'} def compare_prices(product_laughs,product_glomark): # laugfs product html_laugfs = requests.get(product_laughs).content soup_laugfs = BeautifulSoup(html_laugfs, 'html.parser') prod_laugfs = soup_laugfs.find('span',class_="regular-price") prodName = soup_laugfs.find('div',class_="product-name") product_name_laughs=prodName.get_text() prod_laugfs = prod_laugfs.get_text() # Will get text from html tags product_laugfs = prod_laugfs.strip() # Removing special characters like \n (newline) #print(product_name_laughs) prod_price_laugfs = product_laugfs[3:] price_laughs = float(prod_price_laugfs) #print(price_laughs) # Glomark product html_glomark = requests.get(product_glomark).content soup_glomark = BeautifulSoup(html_glomark, 'html.parser') prod_glomark = soup_glomark.find('script',type="application/ld+json") prod_glomark = prod_glomark.get_text() prod_glomark = json.loads(prod_glomark) product_name_glomark = prod_glomark['description'] offers_glomark = prod_glomark['offers'][0] price_glomark = float(offers_glomark['price']) #print(product_name_glomark) #print(price_glomark) print('Laughs ',product_name_laughs,'Rs.: ' , price_laughs) print('Glomark ',product_name_glomark,'Rs.: ' , price_glomark) if(price_laughs>price_glomark): print('Glomark is cheaper Rs.:',price_laughs - price_glomark) elif(price_laughs<price_glomark): print('Laughs is cheaper Rs.:',price_glomark - price_laughs) else: print('Price is the same') laughs_coconut = 'https://scrape-sm1.github.io/site1/COCONUT%20market1super.html' glomark_coconut = 'https://glomark.lk/coconut/p/11624' laughs_tissues = 'https://www.laugfssuper.com/index.php/categories/household/flora-facial-tissues-2-x-160-box.html' glomark_tissues = 'https://glomark.lk/flora-facial-tissues-160s/p/10470' laughs_bread = 'https://www.laugfssuper.com/index.php/crimson-bread-sliced-111452.html' glomark_bread = 'https://glomark.lk/top-crust-bread/p/13676' #compare_prices(laughs_coconut,glomark_coconut) compare_prices(laughs_bread,glomark_bread)[/CODE] [/QUOTE]
Insert quotes…
Verification
Hata thunen beduwama keeyada? (60 bedeema thuna)
Post reply
Top
Bottom