UltimaScraper icon indicating copy to clipboard operation
UltimaScraper copied to clipboard

KeyError: 'filename'

Open IT6uru opened this issue 5 years ago • 20 comments

This appears to be happening after #830 fix for some accounts

Type: Messages Scraping [photo]. Should take less than a minute. Traceback (most recent call last): File "Z:\OF\OnlyFans-master\start_ofd.py", line 43, in apis = main_datascraper.start_datascraper(json_config, site_name_lower) File "Z:\OF\OnlyFans-master\datascraper\main_datascraper.py", line 98, in start_datascraper names = main_helper.process_names( File "Z:\OF\OnlyFans-master\helpers\main_helper.py", line 625, in process_names result = module.start_datascraper( File "Z:\OF\OnlyFans-master\modules\onlyfans.py", line 147, in start_datascraper results = prepare_scraper( File "Z:\OF\OnlyFans-master\modules\onlyfans.py", line 705, 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 "Z:\OF\OnlyFans-master\modules\onlyfans.py", line 1072, in media_scraper found_medias = [x for x in post["medias"] File "Z:\OF\OnlyFans-master\modules\onlyfans.py", line 1073, in if x["filename"] == new_media["filename"]] KeyError: 'filename'

IT6uru avatar Feb 17 '21 02:02 IT6uru

I need the model's name

UltimaHoarder avatar Feb 20 '21 21:02 UltimaHoarder

Here's my error after latest update

Scrape Processing
Name: emblack
Type: Profile
0.00B [00:00, ?B/s]
Type: Stories
Scraping [photo]. Should take less than a minute.
Scraping [photo]. Should take less than a minute.
Scraping [photo]. Should take less than a minute.
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 [video | stream | gif]. Should take less than a minute.
Scraping [video | stream | gif]. Should take less than a minute.
Traceback (most recent call last):
  File "/OnlyFans-master 6/start_ofd.py", line 43, in <module>
    apis = main_datascraper.start_datascraper(json_config, site_name_lower)
  File "/OnlyFans-master 6/datascraper/main_datascraper.py", line 98, in start_datascraper
    names = main_helper.process_names(
  File "/OnlyFans-master 6/helpers/main_helper.py", line 625, in process_names
    result = module.start_datascraper(
  File "/OnlyFans-master 6/modules/onlyfans.py", line 147, in start_datascraper
    results = prepare_scraper(
  File "/OnlyFans-master 6/modules/onlyfans.py", line 705, in prepare_scraper
    unrefined_set = pool.starmap(media_scraper, product(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 372, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/OnlyFans-master 6/modules/onlyfans.py", line 1075, in media_scraper
    found_medias = [x for x in medias
  File "/OnlyFans-master 6/modules/onlyfans.py", line 1076, in <listcomp>
    if x["filename"] == new_media["filename"]]
KeyError: 'filename'

londontrapstar avatar Feb 21 '21 00:02 londontrapstar

also getting this error on the latest commit with scrape_paid_content sent to true, scrape completes without errors when it's set to false.

headphonia avatar Feb 21 '21 16:02 headphonia

Same issue as described here. The model it fails on is the same model that caused 'medias' key error described in issue #823 . Error output here (with model name):

Scrape Processing
Name: pixei
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 [photo]. Should take less than a minute.
Scraping [photo]. Should take less than a minute.
Scraping [photo]. Should take less than a minute.
Traceback (most recent call last):
  File "/.../OnlyFans/start_ofd.py", line 43, in <module>
    apis = main_datascraper.start_datascraper(json_config, site_name_lower)
  File "/.../OnlyFans/datascraper/main_datascraper.py", line 98, in start_datascraper
    names = main_helper.process_names(
  File "/.../OnlyFans/helpers/main_helper.py", line 625, in process_names
    result = module.start_datascraper(
  File "/.../OnlyFans/modules/onlyfans.py", line 147, in start_datascraper
    results = prepare_scraper(
  File "/.../OnlyFans/modules/onlyfans.py", line 705, in prepare_scraper
    unrefined_set = pool.starmap(media_scraper, product(
  File "/.../.pyenv/versions/3.9.1/lib/python3.9/multiprocessing/pool.py", line 372, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/.../.pyenv/versions/3.9.1/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
  File "/.../.pyenv/versions/3.9.1/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/.../.pyenv/versions/3.9.1/lib/python3.9/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/.../OnlyFans/modules/onlyfans.py", line 1075, in media_scraper
    found_medias = [x for x in medias
  File "/.../OnlyFans/modules/onlyfans.py", line 1076, in <listcomp>
    if x["filename"] == new_media["filename"]]
KeyError: 'filename'

scgreenhalgh avatar Feb 22 '21 02:02 scgreenhalgh

also getting this error on the latest commit with scrape_paid_content sent to true, scrape completes without errors when it's set to false.

Can confirm this works too.

scgreenhalgh avatar Feb 22 '21 02:02 scgreenhalgh

I still get the error, has this been fixed?

londontrapstar avatar Feb 22 '21 02:02 londontrapstar

Just chiming in with my experience of the same error. Crashing on paid content from "roselle888", before I even get the choice of scraping profile feeds. Her profile is free, but doesn't seem like that matters?

Scraping - roselle888 | 30 / 46
Scraping [photo]. Should take less than a minute.
Scraping [video | stream | gif]. Should take less than a minute.
Traceback (most recent call last):
  File "/home/user/projects/OF/OnlyFans/start_ofd.py", line 43, in <module>
    apis = main_datascraper.start_datascraper(json_config, site_name_lower)
  File "/home/user/projects/OF/OnlyFans/datascraper/main_datascraper.py", line 95, in start_datascraper
    paid_content = module.paid_content_scraper(apis, identifiers)
  File "/home/user/projects/OF/OnlyFans/modules/onlyfans.py", line 353, in paid_content_scraper
    unrefined_set = media_scraper(paid_content, api, subscription,
  File "/home/user/projects/OF/OnlyFans/modules/onlyfans.py", line 1075, in media_scraper
    found_medias = [x for x in medias
  File "/home/user/projects/OF/OnlyFans/modules/onlyfans.py", line 1076, in <listcomp>
    if x["filename"] == new_media["filename"]]
KeyError: 'filename'

I tested on my alt account and purchased something recent from that creator as well and I am getting the same error.

AlexDucks avatar Feb 22 '21 09:02 AlexDucks

I encountered this problem too. Turns out chances are the x doesn't have a key called "filename". So I made some tweak myself and it worked.

found_medias = [x for x in medias
                                            if "filename" in x
                                                if x["filename"] == new_media["filename"]]

alextuan1024 avatar Feb 23 '21 09:02 alextuan1024

@alextuan1024

found_medias = [x for x in "medias" if "filename" in x if x["filename"] == new_media["filename"]]

medias should be in quotes. This works.

IT6uru avatar Feb 23 '21 23:02 IT6uru

@alextuan1024

found_medias = [x for x in "medias"

                                        if "filename" in x 

  			    if x["filename"] == new_media["filename"]]

medias should be in quotes. This works.

@IT6uru I'm not sure, man. I'm not a python programmer, but isn't it iterating the string "media"?

alextuan1024 avatar Feb 24 '21 00:02 alextuan1024

I get an error without the quotes. Weird.

IT6uru avatar Feb 24 '21 00:02 IT6uru

I need the model's name

Try iambianka

alextuan1024 avatar Feb 24 '21 00:02 alextuan1024

Has this fix been corrected, or am I missing out on something?

londontrapstar avatar Feb 24 '21 08:02 londontrapstar

Has this fix been corrected, or am I missing out on something?

There hasn't been a fix released yet, but you can manually patch the modules/onlyfans.py file as described by @alextuan1024 in this comment.

AlexDucks avatar Feb 24 '21 16:02 AlexDucks

Has this been fixed, or do we still need to resort to the temporary workaround noted above?

avekifes avatar Mar 02 '21 04:03 avekifes

Don't use the workaround with quotes. All it does is just assign an empty list to found_medias, because it's iterating over the characters in the string "medias" (literally "m", "e", "d", "i", "a", "s"). Then it's checking to see if "filename" is in each of those characters, which it isn't, so it doesn't end up actually doing anything.

That "fix" is the same as just doing: found_medias = []

herefromrdt avatar Mar 04 '21 19:03 herefromrdt

I encountered this problem too. Turns out chances are the x doesn't have a key called "filename". So I made some tweak myself and it worked.

found_medias = [x for x in medias
                                            if "filename" in x
                                                if x["filename"] == new_media["filename"]]

You can try the latest commit. It's basically the same as what alextuan suggested.

UltimaHoarder avatar Mar 06 '21 07:03 UltimaHoarder

I encountered this problem too. Turns out chances are the x doesn't have a key called "filename". So I made some tweak myself and it worked.

found_medias = [x for x in medias
                                            if "filename" in x
                                                if x["filename"] == new_media["filename"]]

You can try the latest commit. It's basically the same as what alextuan suggested.

I have 6.4.1. and still getting the "medias" keyerror. I also tried to manually do this alextuan fix, but it doesn't work.

massivroom avatar Mar 06 '21 16:03 massivroom

I encountered this problem too. Turns out chances are the x doesn't have a key called "filename". So I made some tweak myself and it worked.

found_medias = [x for x in medias
                                            if "filename" in x
                                                if x["filename"] == new_media["filename"]]

You can try the latest commit. It's basically the same as what alextuan suggested.

I have 6.4.1. and still getting the "medias" keyerror. I also tried to manually do this alextuan fix, but it doesn't work.

A release version isn't the same as the latest commit, you can download it from here

https://github.com/DIGITALCRIMINAL/OnlyFans/archive/master.zip

UltimaHoarder avatar Mar 06 '21 16:03 UltimaHoarder

I encountered this problem too. Turns out chances are the x doesn't have a key called "filename". So I made some tweak myself and it worked.

found_medias = [x for x in medias
                                            if "filename" in x
                                                if x["filename"] == new_media["filename"]]

You can try the latest commit. It's basically the same as what alextuan suggested.

I have 6.4.1. and still getting the "medias" keyerror. I also tried to manually do this alextuan fix, but it doesn't work.

A release version isn't the same as the latest commit, you can download it from here

https://github.com/DIGITALCRIMINAL/OnlyFans/archive/master.zip

thanks man, I'm a noob on github..

This works for me

massivroom avatar Mar 07 '21 21:03 massivroom