Skip to content
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

VSCO.co An unexpected error occurred: JSONDecodeError - Expecting value: line 1 column 67581 (char 67580) #6887

Closed
zone559 opened this issue Jan 27, 2025 · 3 comments · Fixed by #6891

Comments

@zone559
Copy link

zone559 commented Jan 27, 2025

C:\Users\Desktop\Downloads>gallery-dl --verbose https://vsco.co/culture-vulture/
[config][error] JSONDecodeError when loading 'C:\Users\Desktop\AppData\Roaming\gallery-dl\config.json': Expecting property name enclosed in double quotes: line 7 column 9 (char 228)
[gallery-dl][debug] Version 1.28.4 - Executable (stable/windows)
[gallery-dl][debug] Python 3.8.10 - Windows-10-10.0.19045
[gallery-dl][debug] requests 2.32.3 - urllib3 2.2.3
[gallery-dl][debug] Configuration Files []
[gallery-dl][debug] Starting DownloadJob for 'https://vsco.co/culture-vulture/'
[vsco][debug] Using VscoUserExtractor for 'https://vsco.co/culture-vulture/'
[vsco][debug] Using VscoGalleryExtractor for 'https://vsco.co/culture-vulture/gallery'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): vsco.co:443
[urllib3.connectionpool][debug] https://vsco.co:443 "GET /culture-vulture/gallery HTTP/11" 200 None
[vsco][error] An unexpected error occurred: JSONDecodeError - Expecting value: line 1 column 67581 (char 67580). Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[vsco][debug]
Traceback (most recent call last):
File "gallery_dl\job.pyc", line 152, in run
File "gallery_dl\extractor\vsco.pyc", line 33, in items
File "gallery_dl\extractor\vsco.pyc", line 144, in images
File "gallery_dl\extractor\vsco.pyc", line 73, in _extract_preload_state
File "json\decoder.pyc", line 337, in decode
File "json\decoder.pyc", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 67581 (char 67580)


how json is strurture

{
"media": [
{
"type": "image",
"image": {
"_id": "6797a402862a8f141f04157e",
"grid_name": "for the culture lil bih",
"adaptive_base": "/i/6797a402862a8f141f04157e",
"site_id": 155056545,
"site_profile_image_url": "i.vsco.co/5e9c320a529cfb63f554b6ae",
"description": "",
"description_anchored": "",
"copyright_classes": [
"reserved"
],
"capture_date": 1737991171199,
"capture_date_ms": 1737991171199,
"upload_date": 1737991171199,
"last_updated": 1737991171467,
"location_coords": null,
"has_location": false,
"feature_link": null,
"is_featured": false,
"is_video": false,
"perma_domain": "vsco.co/culture-vulture",
"perma_subdomain": "culture-vulture",
"permalink": "http://vsco.co/culture-vulture/media/6797a402862a8f141f04157e",
"share_link": "http://vsco.co/culture-vulture/media/6797a402862a8f141f04157e?share=MTczNzk5MTE3MQ%3D%3D",
"responsive_url": "im.vsco.co/aws-us-west-2/ddaf75/155056545/6797a402862a8f141f04157e/vsco_012725.jpg",
"show_location": 0,
"image_status": {
"code": 1,
"time": 1737991171191
},
"image_meta": {
"copyright": "Copyright 2025. All rights reserved.",
"make": "Apple",
"model": "iPhone",
"orientation": 1,
"software": "VSCO",
"extension": 2,
"file_size": 229576,
"file_hash": "343aab7b6df057cbe395e4dfa715946a"
},
"height": 1179,
"width": 1170
}
},

Source: https://vsco.co/api/3.0/medias/profile?site_id=155056545


this python code get json code

import requests

# Define the URL
url = "https://vsco.co/api/3.0/medias/profile?site_id=155056545"

# Define the headers
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
    "Authorization": "Bearer 7356455548d0a1d886db010883388d08be84d0c9",  # Use the token in the Authorization header
}

# Send the GET request
response = requests.get(url, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    # Print the JSON content
    print(response.json())  # Use .json() to parse the response as JSON
else:
    print(f"Failed to retrieve data. Status code: {response.status_code}")
    print(f"Response: {response.text}")  # Print the response for debugging
@zone559 zone559 changed the title VSCO downloader does not work anymore VSCO.co An unexpected error occurred: JSONDecodeError - Expecting value: line 1 column 67581 (char 67580) Jan 28, 2025
@CasualYT31
Copy link
Contributor

CasualYT31 commented Jan 28, 2025

Seems like the offender is "prevPageToken":undefined,, right at the end of the JSON object extracted from the VSCO page. I added a dodgy replace() call to get rid of it and extraction seems to work without any issues.

Image

Image

CasualYT31 added a commit to CasualYT31/gallery-dl-tiktok-support that referenced this issue Jan 28, 2025
@stefinuxha
Copy link

I've tried the fix locally and is working thanks!

Btw I had slightly different error char: [vsco][error] An unexpected error occurred: JSONDecodeError - Expecting value: line 1 column 68300 (char 68299).

@CasualYT31
Copy link
Contributor

@stefinuxha Yes, the character will be different for each user since each user will have a different JSON object (and the object will change for the same user if they e.g. upload a new photo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants