I'm trying Gmarket crawl, but I don't know what to do. Please give me some help.

Asked 1 weeks ago, Updated 1 weeks ago, 3 views

Hi, everyone. The crawl I'm trying to extract from Gmarket's keyword search by selecting only the purchased list.

The address is as follows.


In the HTML structure, I tried to extract by distinguishing whether there is a list-item__pay-count or not.

<div class="box__information-score">
<ul class="list__score">
 <li-class="list-item list-item__pay-count"><span class="text"> Purchase 
 <!-- -->
 1</span><span class="for-a11y">Gun</span></li>

So I made the code as below.I don't know what to do because I don't think it's coming out.

import requests
from bs4 import BeautifulSoup
import time

res = requests.get("https://browse.gmarket.co.kr/search?keyword=%ec%95%84%ec%9d%b4%ed%8f%b013&f=is:cb")
html = res.text
soup = BeautifulSoup(html, 'html.parser')

item_containers = soup.select(".box__item-container")
for item_container in item_containers :
    if item_container == '.list-item__pay-count' :

Please help me ㅠ_ㅠ


2022-09-20 11:34

1 Answers

That site is a dynamic web page, so the HTML I checked on the browser and the HTML I received as a request seem to be different. You can try it with selenium

2022-09-20 11:34

If you have any answers or tips

© 2022 pinfo. All rights reserved.