2 minute read

Phone Comparison Website Project Github

Website Goal:

This website lets the users two phones through search engine and compares them for the user. Unlike other websites where they list out features of two phones, our website tells the user what is different by how much and also gives advice to the user.

์ด ์‚ฌ์ดํŠธ๋Š” ์œ ์ €๊ฐ€ ํ•ธ๋“œํฐ ๋‘๊ฐœ๋ฅผ ๊ณ ๋ฅด๋ฉด ๊ทธ ํ•ธ๋“œํฐ์„ ๋น„๊ตํ•œ ๋’ค ํŠน์ • ์ŠคํŽ™์ด ์–ผ๋งŒํผ ์ฐจ์ด๋‚˜๋Š”์ง€ ๊ฐ€๋ฅด์ณ ์ฃผ๋Š” ์‚ฌ์ดํŠธ๋‹ค. ์—ฌํƒ€ ์‚ฌ์ดํŠธ์™€๋Š” ๋‹ค๋ฅด๊ฒŒ ๋‘ ํ•ธ๋“œํฐ์˜ ์ •๋ณด๋ฅผ ๋‚˜์—ด ํ•ด์ฃผ๋Š” ๊ฒƒ์€ ๊ธฐ๋ณธ์ด๋ฉฐ ์ฐจ์ด์ ์„ ์‰ฝ๊ฒŒ ์„ค๋ช… ํ•ด์ฃผ๋ฉฐ ์กฐ์–ธ๊นŒ์ง€ ํ•ด์ฃผ๋Š” ์‚ฌ์ดํŠธ์ด๋‹ค.

Design:

Our website collects phone datas form โ€œDanawa,โ€ and use search engine to let user choose two phones they want to compare. After user chooses two phones, we give advice by comparing two numerical values of phones features and give comparison and analytical advice.

์ด ์‚ฌ์ดํŠธ๋Š” ๋‹ค๋‚˜์™€๋ฅผ ํ†ตํ•ด ํ•ธ๋“œํฐ ์ •๋ณด๋ฅผ ์–ป์œผ๋ฉด ๊ฒ€์ƒ‰ ์—”์ง„์„ ์ด์šฉํ•˜์—ฌ ์œ ์ €๊ฐ€ ๋น„๊ต๋ฅผ ์›ํ•˜๋Š” ํ•ธ๋“œํฐ์„ ๊ฒ€์ƒ‰ ์‹œ ๋ณด์—ฌ์ฃผ๊ณ  ๊ณ ๋ฅด๊ฒŒ ํ•œ๋‹ค. ์œ ์ €๊ฐ€ ํ•ธ๋“œํฐ์„ ๊ณ ๋ฅด๊ณ  ๋‚œ ํ›„์— ๋‘ ํ•ธ๋“œํฐ์˜ ์ŠคํŽ™์„ ๋น„๊ตํ•˜์—ฌ ์œ ์ €์—๊ฒŒ ์กฐ์–ธ์„ ํ•ด์ค€๋‹ค.

Problems:

๋‹ค๋‚˜์™€ ๊ฐ™์€ ์‚ฌ์ดํŠธ๋Š” ๋™์  ํŽ˜์ด์ง€๋ผ์„œ HTML ํƒœ๊ทธ ๊ตฌ์กฐ๋ฅผ ํŒŒ์•…ํ•˜๊ธฐ ์–ด๋ ต๋‹ค. ๋”ฐ๋ผ์„œ, Beautifulsoup, requests ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ selenium๋„ ์‚ฌ์šฉํ•ด์•ผ ํŒŒ์•…์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

๐ŸงSelenium์„ ์‚ฌ์šฉํ•˜๋ฉด ๋Š๋ฆฌ๋‹ค๋Š” ๋‹จ์ ์ด ์žˆ๋‹ค.

๊ฐœ๋ฐœ์ž ๋„๊ตฌ์—์„œ ์š”์†Œ๋ž‘ ์†Œ์Šค๊ฐ€ ๋‹ค๋ฅด๋ฉด ๋™์  ์›น์‚ฌ์ดํŠธ์ธ์ง€ ๋ฐ”๋กœ ํ™•์ธ ๊ฐ€๋Šฅ

๋˜‘๊ฐ™์€ ํ•ธ๋“œํฐ ๊ฑฐ๋ฅผ ์ˆ˜ ์žˆ๋„๋ก ๊ตฌํ˜„ํ•˜๊ธฐ

Data:

Functions:

Main.py: creates the overall website

Scrapper.py: extract information form website

  • extract_phone:
    • input:
      1. html: gets the tags of phones
    • function: extract the phone information from the html tags
    • return: return dictionary of phones different informations
  • extract_phones:
    • input:
      1. last_page: gets total pages, but there are too many phones, so only recent 10 pages
      2. url: for links of different pages
    • function: use extract_phone function to get data from different pages and put them into phones array
    • return: phones array

export.py: turn information into .csv file

Website:

Search Engine:

Need a search engine to access the data

Comparison Page :

Need to load user chosen phone data

Web Framework:

Flask:

  • Micro Framework
  • Designed for one application
  • Does not have ๐ŸงORM(Object Relational Mapping)
  • Easier to add new features

Django:

  • Full-stack Framework
  • Designed for multiple application
  • Has ORM
  • Complex to add new features

๐Ÿง When communicating with database one has to use the query, this query differs by every database(MySQL, Oracle โ€ฆ etc) and ORM is a function that helps us use python instead of query

Port Forwarding:

Tried port forwarding to access website from other device that is not local. Coding did not need any change, but only need to change the setting of the router. Had to set the internal and external port number range for the router.

Leave a comment