Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python flickr_scraper.py --search 'honeybees on flowers' --n 10 --download #34

Open
qiyangchennrel opened this issue Jul 11, 2024 · 3 comments

Comments

@qiyangchennrel
Copy link

When I tried to download the images, I got the errors below:

nargs ['honeybees on flowers']
0/10 error...
1/10 error...
2/10 error...
3/10 error...
4/10 error...
5/10 error...
6/10 error...
7/10 error...
8/10 error...
9/10 error...
10/10 error...
Done. (4.4s)

@pderrenger
Copy link
Member

@qiyangchennrel hello!

Thank you for reaching out and providing details about the issue you're encountering. To help us diagnose and resolve the problem effectively, could you please provide a minimum reproducible example of your code? This will allow us to better understand the context and pinpoint the issue. You can find guidance on creating a reproducible example here: Minimum Reproducible Example.

Additionally, please ensure that you are using the latest versions of all relevant packages, as updates often include important bug fixes and improvements.

Looking forward to your response so we can assist you further! 😊

@nzhang95120
Copy link

After following all steps and even performing it on a google colab terminal, I am also getting the error...
Screenshot 2024-08-11 at 4 58 31 PM

@glenn-jocher
Copy link
Member

Hello @nzhang95120,

Thank you for providing the screenshot and additional details about the issue you're encountering. It looks like you're running into some trouble with the flickr_scraper.py script.

Here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Verify Package Versions: Ensure that you are using the latest versions of all relevant packages. Sometimes, issues are resolved in newer releases. You can update your packages using:

    pip install --upgrade <package_name>
  2. Check Dependencies: Make sure all dependencies required by the script are installed. You can usually find these in the requirements.txt file or documentation of the repository.

  3. Error Logs: The error messages you provided are quite generic. If possible, try to capture more detailed error logs. This can often be done by running the script with increased verbosity or debug flags.

  4. Internet Connection: Ensure that your internet connection is stable, as the script needs to download images from Flickr.

  5. API Keys: If the script requires API keys for accessing Flickr, ensure that they are correctly set up and have the necessary permissions.

  6. Example Code: Here is a minimal example to ensure everything is set up correctly:

    import flickrapi
    import urllib.request
    import os
    
    # Replace with your own Flickr API key and secret
    api_key = 'YOUR_API_KEY'
    api_secret = 'YOUR_API_SECRET'
    
    flickr = flickrapi.FlickrAPI(api_key, api_secret, format='parsed-json')
    query = 'honeybees on flowers'
    num_images = 10
    
    photos = flickr.photos.search(text=query, per_page=num_images, media='photos', sort='relevance')
    for i, photo in enumerate(photos['photos']['photo']):
        url = f"http://farm{photo['farm']}.staticflickr.com/{photo['server']}/{photo['id']}_{photo['secret']}.jpg"
        urllib.request.urlretrieve(url, os.path.join('downloads', f"{i}.jpg"))
        print(f"Downloaded {i+1}/{num_images}")
    
    print("Done.")

If you have verified all the above and the issue persists, please let us know with any additional error logs or details. This will help us assist you more effectively.

Thank you for your patience and cooperation! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants