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

Asked 2 years ago, Updated 2 years ago, 58 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.

https://browse.gmarket.co.kr/search?keyword=%ec%95%8c%ea%b5%ac%ec%8a%ac&f=is:cb

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>
</ul>
</div>

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' :
        print('test')

Please help me ㅠ_ㅠ

crawling

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


© 2024 OneMinuteCode. All rights reserved.