iamatulsingh / pinscrape

A simple library to scrape Pinterest images written in Python
MIT License
78 stars 15 forks source link

Issue with "Nothing to download" #30

Closed AlexRyabikov closed 2 weeks ago

AlexRyabikov commented 3 weeks ago

Hi! I installed pinscrape via pip and tried several keywords. In each case, I encountered the following error:

PS C:\Users\alex-\yandex_images_parser> & C:/Users/alex-/AppData/Local/Programs/Python/Python312/python.exe c:/Users/alex-/yandex_images_parser/grabber_pinterest.py

Nothing to download !! {'isDownloaded': False, 'search_engine_status_code': 200, 'url_list': [], 'extracted_urls': [], 'keyword': 'vynil aesthetic 
photo'}

Here's my code (just the example from the documentation):

from pinscrape import pinscrape

details = pinscrape.scraper.scrape("vynil aesthetic photo", "images/vynil", {}, 10, 15)

if details["isDownloaded"]:
    print("\nDownloading completed !!")
    print(f"\nTotal urls found: {len(details['extracted_urls'])}")
    print(
        f"\nTotal images downloaded (including duplicate images): {len(details['urls_list'])}"
    )
    print(details)
else:
    print("\nNothing to download !!", details)

I'm using Python version 3.12.

Output of "pip show pinscrape":

Name: pinscrape
Version: 3.2.3
Summary: Pinterest | a simple data scraper for pinterest
Home-page: https://github.com/iamatulsingh/pinscrape
Author: Atul Singh
Author-email: atulsingh0401@gmail.com
License:
Location: C:\Users\alex-\AppData\Local\Programs\Python\Python312\Lib\site-packages
Requires: beautifulsoup4, opencv-python, pydotmap, pytest, requests
Required-by:

Could you help me please determine what the issue might be? Also, how can I obtain more debugging information?

Thanks!

iamatulsingh commented 3 weeks ago

Hi @AlexRyabikov, I have updated code to tackle this new issue. You can upgrade to version v3.2.4 and test again. Please let me know if the problem still persist.

AlexRyabikov commented 3 weeks ago

Hi, thanks! Yep, unfortunately, after update the problem is still persist (update was via 'pip uninstall pinscrape > pip install pinscrape'): 26-10-2024 140552 26-10-2024 140531

iamatulsingh commented 3 weeks ago

I tried the same keyword but it worked for me. I'll try to think more.

AlexRyabikov commented 3 weeks ago

How do you think, could it be geo-related problem? I see, that your class start_scraping use url like: https://www.bing.com/search?q={keyword}&first=1&FORM=PERE

But when I'm trying search in Bing from my current location with link like: https://www.bing.com/search?q=vinyl&first=1&FORM=PERE
I see 0 results from the Pinterest, just shops and other sites

AlexRyabikov commented 3 weeks ago

Hm, no, it seems its wrong hypothesis. Keyword "vynil pinterest" returns results from Pinterest in Bing, but still "Nothing to download" when I run script

iamatulsingh commented 3 weeks ago

Ya, I understand but the problem is I'm able to download images using the search keyword you have used. I'm trying to make my code little better and I'll add one beta code to use from now on but there is a high chance that pinterest might detect something unusual and block it.

AlexRyabikov commented 2 weeks ago

Hi! I've built a docker container on my VDS in different country and, it seems, ur library is really geo-related. Because on server script works perfect, look: 27-10-2024 202339

iamatulsingh commented 2 weeks ago

Hi, thanks for your efforts. I have written new code and I forgot to publish this. New code is totally different depending on Pinterest so if Pinterest have geo based results, then it will show the same else all the results. No more search engine code required.

iamatulsingh commented 2 weeks ago

Hi @AlexRyabikov , I have pushed a new release. Please check the README how to use and also upgrade to version 4.0.0. I hope this would fix the issue. If issue still persist then it, then this is how Pinterest works. This could be a limitation for this library and may be resolve using proxy.

AlexRyabikov commented 2 weeks ago

Thank! Now I'm getting this during process of installation: ` Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [33 lines of output] Traceback (most recent call last): File "C:\Users\alex-\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "C:\Users\alex-\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\alex-\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 112, in get_requires_for_build_wheel backend = _build_backend() ^^^^^^^^^^^^^^^^ File "C:\Users\alex-\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 77, in _build_backend obj = import_module(mod_path) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\alex-\AppData\Local\Programs\Python\Python312\Lib\importlib__init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1381, in _gcd_import File "", line 1354, in _find_and_load File "", line 1304, in _find_and_load_unlocked File "", line 488, in _call_with_frames_removed File "", line 1381, in _gcd_import File "", line 1354, in _find_and_load File "", line 1325, in _find_and_load_unlocked File "", line 929, in _load_unlocked File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "C:\Users\alex-\AppData\Local\Temp\pip-build-env-a326jn6w\overlay\Lib\site-packages\setuptools\init.py", line 16, in import setuptools.version File "C:\Users\alex-\AppData\Local\Temp\pip-build-env-a326jn6w\overlay\Lib\site-packages\setuptools\version.py", line 1, in import pkg_resources File "C:\Users\alex-\AppData\Local\Temp\pip-build-env-a326jn6w\overlay\Lib\site-packages\pkg_resources\init__.py", line 2172, in register_finder(pkgutil.ImpImporter, find_on_path) ^^^^^^^^^^^^^^^^^^^ AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.`

iamatulsingh commented 2 weeks ago

Hi, I just installed it on Windows, WSL and Linux system and all worked fine. I think please currently don't use python 3.12. Lot's of things are changed in that and I'll need good amount of time to check what all things I need to update/change/remove. Please try once with python 3.11 or earlier using python virtual environment.

AlexRyabikov commented 2 weeks ago

Hi! Maybe I'm doing wrong, but, idk, it seems its really geo-related behavior (with 3.11): 29-10-2024 195809

using_search_engine - same error using_pinterest_apis - returns nothing

I guess its really how Pinterest works :) I will use my ubuntu server for this library

Thanks for your help!

iamatulsingh commented 2 weeks ago

Sorry for that. I thought calling Pinterest api directly will work but as you said it seems Pinterest shows data according to geo location. May be you can try proxy of some country if you really want geo based data.

If you want, you can close this issue else leave it for a while.

AlexRyabikov commented 2 weeks ago

Yep, thanks again :)