Coder Social home page Coder Social logo

Comments (3)

hwchase17 avatar hwchase17 commented on August 14, 2024

not sure how to help, more info needed

from opengpts.

saber-qqq avatar saber-qqq commented on August 14, 2024

import pandas as pd
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time

Initialize Chrome WebDriver

options = Options()
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
options.headless = True # Modify as needed
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)

Navigate to DHgate homepage

driver.get("https://www.dhgate.com")

Wait for the page to load

time.sleep(10)

Find the search box and search for 'shoes'

search_box = driver.find_element(By.NAME, "searchkey")
search_box.send_keys("shoes")
search_box.send_keys(Keys.RETURN)

time.sleep(10) # Wait for search results

Sort by 24-hour sales ranking, if possible

Scrape the top 500 product links

links = []
product_links = driver.find_elements(By.CSS_SELECTOR, "a.product-link") # Adjust selector as needed
for link in product_links[:500]:
links.append(link.get_attribute('href'))

Close the WebDriver

driver.quit()

Save the links in a DataFrame and then to a CSV file

df = pd.DataFrame(links, columns=["Product Link"])
df.to_csv("top_500_shoes_links.csv", index=False)

print("Top 500 product links for shoes saved to 'top_500_shoes_links.csv'")

脚本如上 基于谷歌游览器 想要获取的是shoes的类目的24小时的销量排行

from opengpts.

saber-qqq avatar saber-qqq commented on August 14, 2024

最直接点能不能让gtp可以访问外部网站 或者能基于gtp4上运行代码以便方便修改呢

from opengpts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.