atom-community / atom-community/atom-script

Encoding error in parsing a price and printing it

Open
#2,120 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
730
Forks
264
PR merge metrics
No merged PRs in 30d

Description

When I run the below code to get price for a site I already have
---
import bs4
import requests #this download the actual content

res = requests.get('https://www.flipkart.com/mi-xxq01hm-runtime-90-min-trimmer-men/p/itm97cba5cc90e84?pid=TMRFJPH3DBURGEZR&lid=LSTTMRFJPH3DBURGEZRTPHPDK&marketplace=FLIPKART&spotlightTagId=BestsellerId_zlw%2F79s%2Fby3&srno=s_1_1&otracker=search&otracker1=search&fm=organic&iid=a3487d88-0256-4534-82f0-ab4ba9df7946.TMRFJPH3DBURGEZR.SEARCH&ppt=sp&ppn=sp&ssid=7gh3ih5dkw0000001588352716882&qH=705a17deac7a99db')

soup = bs4.BeautifulSoup(res.text, "html.parser")
elems = soup.select("#container > div > div.t-0M7P._3GgMx1._2doH3V > div._3e7xtJ > div._1HmYoV.hCUpcT > div._1HmYoV._35HD7C.col-8-12 > div:nth-child(2) > div > div._3iZgFn > div._2i1QSc > div > div._1vC4OE._3qQ9m1")
print(elems[0].text)
------------

it throws encoding error however atom encoding set to UTF-8 already and the script is giving desired output when run through console or pythton IDLE.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.