UltimaScraper icon indicating copy to clipboard operation
UltimaScraper copied to clipboard

KeyError: 'author'

Open tocking opened this issue 5 years ago • 30 comments

Running on latest Master copy...

Scrape Processing Name: paxclusive Type: Profile Type: Stories No Stories Found. Type: Posts Scrape Attempt: 1/100 Type: Archived Posts Scrape Attempt: 1/100 Traceback (most recent call last): File "G:\OF2\OnlyFans-master\start_ofd.py", line 62, in loop.run_until_complete(main()) File "C:\Users<USERNAME>\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete return future.result() File "G:\OF2\OnlyFans-master\start_ofd.py", line 46, in main api = await main_datascraper.start_datascraper( File "G:\OF2\OnlyFans-master\datascraper\main_datascraper.py", line 93, in start_datascraper await main_helper.process_names( File "G:\OF2\OnlyFans-master\helpers\main_helper.py", line 921, in process_names result = await module.start_datascraper(authed, username, site_name) File "G:\OF2\OnlyFans-master\modules\onlyfans.py", line 159, in start_datascraper await prepare_scraper(authed, site_name, item) File "G:\OF2\OnlyFans-master\modules\onlyfans.py", line 786, in prepare_scraper master_set += await subscription.get_archived_posts() File "G:\OF2\OnlyFans-master\apis\onlyfans\classes\create_user.py", line 424, in get_archived_posts final_results = [create_post(x, self) for x in results if x] File "G:\OF2\OnlyFans-master\apis\onlyfans\classes\create_user.py", line 424, in final_results = [create_post(x, self) for x in results if x] File "G:\OF2\OnlyFans-master\apis\onlyfans\classes\create_post.py", line 13, in init self.author = create_user.create_user(option["author"]) KeyError: 'author'

tocking avatar Jun 29 '21 11:06 tocking

Does this happen every time?

UltimaHoarder avatar Jun 29 '21 22:06 UltimaHoarder

With this model, yep.

tocking avatar Jun 30 '21 05:06 tocking

Not sure if this is related to the same error? I'm getting a similar one which is "KeyError: 'created_at'"

Name: lysaretta
Type: Profile
Type: Stories
No Stories Found.
Type: Posts
Scrape Attempt: 1/100
Type: Archived Posts
Processing Scraped Posts
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:00<00:00, 1689.59it/s]
Processing metadata.
Merging new metadata with legacy metadata.
Finished processing metadata.
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
Traceback (most recent call last):
  File "G:\Scripts\OnlyFans\start_ofd.py", line 60, in <module>
    loop.run_until_complete(main())
  File "C:\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "G:\Scripts\OnlyFans\start_ofd.py", line 44, in main
    api = await main_datascraper.start_datascraper(
  File "G:\Scripts\OnlyFans\datascraper\main_datascraper.py", line 93, in start_datascraper
    await main_helper.process_names(
  File "G:\Scripts\OnlyFans\helpers\main_helper.py", line 921, in process_names
    result = await module.start_datascraper(authed, username, site_name)
  File "G:\Scripts\OnlyFans\modules\onlyfans.py", line 159, in start_datascraper
    await prepare_scraper(authed, site_name, item)
  File "G:\Scripts\OnlyFans\modules\onlyfans.py", line 833, in prepare_scraper
    await process_metadata(
  File "G:\Scripts\OnlyFans\modules\onlyfans.py", line 657, in process_metadata
    result = main_helper.export_sqlite(archive_path, api_type, new_metadata_object)
  File "G:\Scripts\OnlyFans\helpers\main_helper.py", line 564, in export_sqlite
    created_at = media["created_at"]
KeyError: 'created_at'

valdearg avatar Jun 30 '21 17:06 valdearg

Also getting the error with rhoneeandkhoa

tocking avatar Jul 05 '21 02:07 tocking

Any updates on this? It's happening for more models

tocking avatar Jul 10 '21 01:07 tocking

Are you blocking them????

UltimaHoarder avatar Jul 10 '21 01:07 UltimaHoarder

No, I'm subscribed to both and can see the contents in a browser.

tocking avatar Jul 11 '21 07:07 tocking

I'm able to get around this by putting a try/except block around the lines where it fetches the posts (master_set = await subscription.get_posts()) , but this is obviously a bandaid solution. Is there anything I can do to help diagnose the cause of this problem?

tocking avatar Jul 14 '21 13:07 tocking

I found an older commit in my files from june 19 and that one worked for me. Dont know what the difference is between those tho

ghost avatar Jul 20 '21 15:07 ghost

@DIGITALCRIMINAL - anything I can do to help diagnose/debug this issue? It's causing real problems with a few profiles I'm trying to scrape

tocking avatar Jul 21 '21 15:07 tocking

You would need to print out the options variable so I can see what's missing

UltimaHoarder avatar Jul 21 '21 15:07 UltimaHoarder

Sure...where do you want me to put the print statement?

tocking avatar Jul 29 '21 05:07 tocking

Above line 13 in create_post

UltimaHoarder avatar Jul 29 '21 05:07 UltimaHoarder

{'responseType': 'post', 'id': 24256657, 'postedAt': '2020-05-19T13:13:43+00:00', 'postedAtPrecise': '1589894023.000000', 'isReportedByMe': True}

I think we had a similar issue before where it was a post I'd reported once upon a time...

tocking avatar Aug 01 '21 16:08 tocking

I'm getting the same issue with model lovegiavanna. Below is the options printout

{'responseType': 'post', 'id': 46583386, 'postedAt': '2020-09-15T13:51:24+00:00', 'postedAtPrecise': '1600177884.000000', 'isReportedByMe': True}```

EightDee avatar Aug 05 '21 15:08 EightDee

Having the same issue with rileyreidx3. But I actually don't know what to add the get the options printout for further debugging.

deadcode0815 avatar Aug 05 '21 17:08 deadcode0815

Quick and dirty fix/workaround: Change line 395 of apis/api_helper.py to: media_set = [x for x in list(chain(*media_set)) if not x.get('isReportedByMe')]

Charmoq avatar Aug 05 '21 21:08 Charmoq

Quick and dirty fix/workaround: Change line 395 of apis/api_helper.py to: media_set = [x for x in list(chain(*media_set)) if not x.get('isReportedByMe')]

Thank you for this workaround!

naodrej avatar Aug 05 '21 22:08 naodrej

I had the same problem with a model that I subbed to for the first time. The fix/workaround from @Charmoq worked for me.

@DIGITALCRIMINAL

Could the fix from @Charmoq be used in the master or would something speak against it?

ghost avatar Aug 09 '21 11:08 ghost

@Charmoq thank you for workaround, it was only happening on only a few subs, but this seemed to fix it for those. Thanks again to everyone for your work!

porncritic avatar Aug 10 '21 18:08 porncritic