-
Notifications
You must be signed in to change notification settings - Fork 608
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
KeyError: 'source' #2120
Comments
Happens to me too. Worked 3-4 days ago, issue appeared suddenly without any visible reason. Also not model related, tried another one and the error appears there too. |
+1 I pick "scrape all" and still, so I can confirm it has nothing to do with a model in specific, I think source just means OF in general. |
+1 Is this project event maintained anymore? |
Haven't used this in awhile and when I do, I get the same error. |
Some investigation about general updates (because this codebase is old): When looking at recent pypi package dependencies where the error happens with version 1.1.4 of ultima-scraper-api and especially UltimaScraper ITSELF on pypi it seems that the latest UltimaScraper on pypi is newer than what is available in github. I will investigate further but probably upgrading ultimascraper with last pypi sources will maybe or most likely fix this issue? The codebase here is outdated with dependencies 2 years old but the pypi one using recent versions from this year from first view. Interesting links with regular updated codebase (but not UltimaScraper itself somehow): |
@DIGITALCRIMINAL you mind either updating this repo or providing us a new updated Thank you |
It looks like the data structure that OnlyFans is using has changed.
|
I can confirm this is working, TYVM!! UPDATE: I scrapped an account perfecly, and after that I'm getting a ANOTHER UPDATE: the script now seems to be working properly when selecting ALL, maybe some of my models db are corrupted, still testing, but overall this edit works :D |
Ok, after some testing, I noticed the error comes from the change from OF on the preview url's and I cross checked (#2121 (comment)) in the same |
That got my downloads repaired as well, thanks everyone! |
I've tried to replicate the steps but cant make it work. Can anyone upload somewhere a working code version, please? |
Hi everyone, I think this problem has been solved by everyone and it is worked for me now. I will make a summary here. You need to fix The corrected from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from urllib.parse import urlparse
SubscriptionType = Literal["all", "active", "expired", "attention"]
if TYPE_CHECKING:
from ultima_scraper_api.apis.onlyfans.classes.user_model import (
AuthModel,
create_user,
)
class SiteContent:
def __init__(self, option: dict[str, Any], user: AuthModel | create_user) -> None:
self.id: int = option["id"]
self.author = user
self.media: list[dict[str, Any]] = option.get("media", [])
self.preview_ids: list[int] = []
self.__raw__ = option
def url_picker(self, media_item: dict[str, Any], video_quality: str = ""):
authed = self.get_author().get_authed()
video_quality = (
video_quality or self.author.get_api().get_site_settings().video_quality
)
if not media_item["canView"]:
return
source: dict[str, Any] = {}
media_type: str = ""
if "files" in media_item:
media_type = media_item["type"]
media_item = media_item["files"]
source = media_item["full"]
else:
return
url = source.get("url")
return urlparse(url) if url else None
def preview_url_picker(self, media_item: dict[str, Any]):
preview_url = None
if "files" in media_item:
if (
"preview" in media_item["files"]
and "url" in media_item["files"]["full"]
):
preview_url = media_item["files"]["full"]["url"]
else:
preview_url = media_item["full"]
return urlparse(preview_url) if preview_url else None
def get_author(self):
return self.author
async def refresh(self):
func = await self.author.scrape_manager.handle_refresh(self)
return await func(self.id) Another thing is if you run this project by docker before, you need to rebuild your image and remember to put the fixed FROM python:3.10-slim
RUN apt-get update && apt-get install -y \
curl \
libpq-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
ENV POETRY_HOME=/usr/local/share/pypoetry
ENV POETRY_VIRTUALENVS_CREATE=false
RUN curl -sSL https://install.python-poetry.org | python3 -
COPY . .
RUN /usr/local/share/pypoetry/bin/poetry install --only main
COPY .venv/lib/python3.10/site-packages/ultima_scraper_api/apis/onlyfans/__init__.py /usr/src/app/.venv/lib/python3.10/site-packages/ultima_scraper_api/apis/onlyfans/__init__.py
CMD [ "/usr/local/share/pypoetry/bin/poetry", "run", "python", "./start_us.py" ] After those settings, I think you can run it well. |
Hi, I got the KeyError below.
Is anyone know how to fix it?
Thanks a lot.
The text was updated successfully, but these errors were encountered: