You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Step 1: Go to the Chrome browsers
Step 2: Add this extension from Chrome: Fix Discord CDN
Step 3: Try on access the URL and see the image
The code for crawl Image data from multiple links:
fromseleniumimportwebdriverimportpandasaspdimportosimportrequests# Function to save image from a URLdefsave_image_from_url(driver, url, idx):
try:
driver.get(url)
current_url=driver.current_url# Find the image element on the page# Get the source URL of the image# Download the imageimage_name=f'image_{idx}.png'image_path=os.path.join('image_downloads', image_name)
withopen(image_path, 'wb') asf:
f.write(requests.get(current_url).content)
print(f"Image {idx} downloaded successfully.")
exceptExceptionase:
print(f"Error downloading image {idx}: {e}")
# Step 1: Read the CSV filecsv_file_path='b.csv'# Change this to the path of your CSV filedf=pd.read_csv(csv_file_path)
# Step 2: Extract image URLsimage_column_name='Attachments'# Change this to the name of the column containing image URLsimage_urls=df[image_column_name]
# Set up Chrome WebDriver with user profileFILE_NAME_PROFILE='open -a /Applications/Google\ Chrome.app %s'options=webdriver.ChromeOptions()
options.add_argument('--user-data-dir='+FILE_NAME_PROFILE)
options.add_extension('/Users/macbook/Downloads/Segment-Anymate/data/gdljcbcihhoampfcfeokidlbanblkgbg.crx') # Replace with the path to your extension CRX filedriver=webdriver.Chrome(options=options)
# Create a directory to save imagesos.makedirs('image_downloads', exist_ok=True)
# Loop through each URL and save the imageforidx, urlinenumerate(image_urls):
save_image_from_url(driver, url, idx)
# Quit the WebDriverdriver.quit()
You must download the CRM file of Fix Discord CDN extension and put to the same directory with your main code
The text was updated successfully, but these errors were encountered:
Step 1: Go to the Chrome browsers
Step 2: Add this extension from Chrome: Fix Discord CDN
Step 3: Try on access the URL and see the image
The code for crawl Image data from multiple links:
You must download the CRM file of Fix Discord CDN extension and put to the same directory with your main code
The text was updated successfully, but these errors were encountered: