UltimaScraper icon indicating copy to clipboard operation
UltimaScraper copied to clipboard

Crashes for some models - KeyError: 'media'

Open tocking opened this issue 5 years ago • 8 comments

Crashes for some (not all) OF models with the following error:

Type: Profile 0.00B [00:00, ?B/s] Type: Stories No Stories Found. Type: Posts Scrape Attempt: 1/100 Found: Posts Scraping [photo]. Should take less than a minute. Scraping [photo]. Should take less than a minute. Scraping [video | stream | gif]. Should take less than a minute. Scraping [audio]. Should take less than a minute. Scraping [text]. Should take less than a minute. Traceback (most recent call last): File "G:\OF2\OnlyFans-master\start_ofd.py", line 43, in apis = main_datascraper.start_datascraper(json_config, site_name_lower) File "G:\OF2\OnlyFans-master\datascraper\main_datascraper.py", line 104, in start_datascraper names = main_helper.process_names( File "G:\OF2\OnlyFans-master\helpers\main_helper.py", line 630, in process_names result = module.start_datascraper( File "G:\OF2\OnlyFans-master\modules\onlyfans.py", line 155, in start_datascraper results = prepare_scraper( File "G:\OF2\OnlyFans-master\modules\onlyfans.py", line 714, in prepare_scraper unrefined_set = pool.starmap(media_scraper, product( File "C:\Users<USERNAME>\AppData\Local\Programs\Python\Python39\lib\multiprocessing\pool.py", line 372, in starmap return self._map_async(func, iterable, starmapstar, chunksize).get() File "C:\Users<USERNAME>\AppData\Local\Programs\Python\Python39\lib\multiprocessing\pool.py", line 771, in get raise self._value File "C:\Users<USERNAME>\AppData\Local\Programs\Python\Python39\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "C:\Users<USERNAME>\AppData\Local\Programs\Python\Python39\lib\multiprocessing\pool.py", line 51, in starmapstar return list(itertools.starmap(args[0], args[1])) File "G:\OF2\OnlyFans-master\modules\onlyfans.py", line 976, in media_scraper for media in media_api["media"]: KeyError: 'media'

tocking avatar Apr 27 '21 07:04 tocking

What version are you using

UltimaHoarder avatar Apr 27 '21 10:04 UltimaHoarder

Latest version, freshly downloaded two days ago.

tocking avatar Apr 27 '21 14:04 tocking

What's the model's name

UltimaHoarder avatar Apr 28 '21 13:04 UltimaHoarder

rhoneeandkhoa paxclusive

tocking avatar Apr 28 '21 15:04 tocking

EDIT: Figured out what was causing it...but not sure how to fix it. The crash happens whenever there's a post that's been reported. I can get around it by hardcoding the logic to skip a particular Post ID inside the media_scraper function in modules/onlyfans.py.

@DIGITALCRIMINAL - is there a cleaner way to pick up if it's a previously reported post, and skip over it?

image

tocking avatar May 03 '21 02:05 tocking

Ahh interesting. If you check the API response on the website for that post, you may find a key that's related to report ed posts. Maybe there's a "isReported" bool.

UltimaHoarder avatar May 03 '21 12:05 UltimaHoarder

Any pointers for how I would go about finding this info easily? I'm fine on the Python side of things, but the networking side is a bit out of my scope of knowledge...

Edit: Aha! Found it. As part of the response:

"isReportedByMe":true

Now to figure out how to plug that into the main code...

tocking avatar May 03 '21 13:05 tocking

Ahh thank you, I'll be sure to add that to script. I gotta fix the script again...

UltimaHoarder avatar May 03 '21 19:05 UltimaHoarder