Voldrix / onlyfans-dl-2

OnlyFans content downloader v2
GNU General Public License v3.0
179 stars 24 forks source link

KeyError: 'source' when trying to scrape #141

Open ictos opened 3 months ago

ictos commented 3 months ago

Was working fine at the weekend but whenever I try to run it tonight I get this-

./onlyfans-dl.py <redacted> max_age = 10
CWD = /home/ictos/onlyfans-dl-2

Getting posts newer than 2024-08-10 17:47:18 UTC

<redacted> exists.
Downloading new media, skipping pre-existing.
Found 5 posts
Traceback (most recent call last):
  File "/home/ictos/onlyfans-dl-2/./onlyfans-dl.py", line 312, in <module>
    get_content("posts", "/users/" + PROFILE_ID + "/posts")
  File "/home/ictos/onlyfans-dl-2/./onlyfans-dl.py", line 255, in get_content
    download_media(media, MEDIATYPE, postdate, album)
  File "/home/ictos/onlyfans-dl-2/./onlyfans-dl.py", line 178, in download_media
    source = media["source"]["source"]
KeyError: 'source'

I've tried updating the session & cookie variables but nothing seems to work.

Houkannis commented 3 months ago

I'm experiencing the same error

nofate301 commented 3 months ago

+1, I'd guess they changed something in their website and it's breaking the script.

Voldrix commented 3 months ago

Minor change to the site's media api json structure. Fix pushed.

Houkannis commented 3 months ago

Thanks!

nofate301 commented 3 months ago

Seems to be working, but I think it's skipping some video content that I don't have. It's catching up on photos, but some videos are not getting downloaded.

Forger7 commented 3 months ago

Seems to still crash when downloading stories:

Downloading new media, skipping pre-existing.
Found 15 posts
Downloaded 0 new posts
Found 1 archived
Downloaded 0 new archived
Found 1 stories
Traceback (most recent call last):
  File "onlyfans-dl.py", line 321, in <module>
    get_content("stories", "/users/" + PROFILE_ID + "/stories")
  File "onlyfans-dl.py", line 260, in get_content
    download_media(media, MEDIATYPE, postdate, album)
  File "onlyfans-dl.py", line 176, in download_media
    source = media["files"]["source"]["url"]
             ~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'source'
Voldrix commented 3 months ago

I just pushed the change for stories as well.

As for the missing videos, it is because they are encrypted. The script cannot circumvent the video encryption. It should download the preview image in its place as a placeholder.

nemock commented 3 months ago

I tried the code from last night and got this...

Traceback (most recent call last): File "/Volumes/Mando/ofdl/onlyfans-dl.py", line 317, in get_content("posts", "/users/" + PROFILE_ID + "/posts") File "/Volumes/Mando/ofdl/onlyfans-dl.py", line 260, in get_content download_media(media, MEDIATYPE, postdate, album) File "/Volumes/Mando/ofdl/onlyfans-dl.py", line 195, in download_media extension = source.split('?')[0].split('.') ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'split'

waswosi commented 2 months ago

I tried the code from last night and got this...

Traceback (most recent call last): File "/Volumes/Mando/ofdl/onlyfans-dl.py", line 317, in get_content("posts", "/users/" + PROFILE_ID + "/posts") File "/Volumes/Mando/ofdl/onlyfans-dl.py", line 260, in get_content download_media(media, MEDIATYPE, postdate, album) File "/Volumes/Mando/ofdl/onlyfans-dl.py", line 195, in download_media extension = source.split('?')[0].split('.') ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'split'

Same here! Please fix voldrix.

Hammanek commented 2 months ago

I fixed it here https://github.com/Voldrix/onlyfans-dl-2/blob/08498d19f955355ef007bd8ec9764891d36e45b5/onlyfans-dl.py

Voldrix commented 2 months ago

merged

Voldrix commented 2 months ago

I added another small change that fixes the DRM preview image capture for encrypted videos.