Jackhammer9 / RedDownloader

A python library to simplify downloading different types of media from reddit
GNU General Public License v3.0
83 stars 15 forks source link

Unable to fetch posts Expecting value: line 1 column 1 (char 0) #15

Closed samuelbraun04 closed 2 years ago

samuelbraun04 commented 2 years ago

My program is printing the following:

Unable to fetch posts
Expecting value: line 1 column 1 (char 0)

when I run my code:

from RedDownloader.RedDownloader import DownloadVideosBySubreddit
from os import chdir

OUTPUT_PATH = r'C:\Users\samlb\Downloads\TESTING REDDIT'

chdir(OUTPUT_PATH)
DownloadVideosBySubreddit("python", 10)

What am I doing wrong?

Jackhammer9 commented 2 years ago

@samuelbraun04 Are you sure this the exact snippet? Because the issue is not reproducible from the snippet you provided, if you still face any issue make sure you have downloaded the latest version for RedDownloader and reach out to me in case the issue still persists.

Jackhammer9 commented 2 years ago

What you faced looked like a json decode error or an empty json response which happens when my parsing server goes down you might have called that during a brief down time resulting in the issue you can always check for the server status here

samuelbraun04 commented 2 years ago

@JackhammerYT I'm running RedDownloader 3.2.4 on Python 3.9.13 using Windows 10.

I'm still getting the "error" (it's being printed out into my terminal, it's not an exception) even though https://jackhammer.pythonanywhere.com/ says RedDownloader is online.

Everything being printed into my terminal:

Fetching Posts...
Unable to fetch posts
Expecting value: line 1 column 1 (char 0)

(I just noticed that RedDownloader 3.2.5 has been released, but pip doesn't see it yet so I'm still on 3.2.4)

Jackhammer9 commented 2 years ago

@samuelbraun04 I just realized a possible error, r/python doesn't have any whatsoever video posts rendering it useless to try the library on, can you confirm that you are still getting the same error on a sub where videos are actually uploaded? maybe for example r/Unity3D. That's the subreddit I chose while checking for your issue

from RedDownloader.RedDownloader import DownloadVideosBySubreddit
from os import chdir

OUTPUT_PATH = r'C:\Users\samlb\Downloads\TESTING REDDIT'

chdir(OUTPUT_PATH)
DownloadVideosBySubreddit("Unity3D", 1)
samuelbraun04 commented 2 years ago

@JackhammerYT Yep that worked. I don't know why I didn't think to check if r/python even had any videos.

Now my program actually goes and downloads something, but I'm not sure if it's downloading the right stuff.

When I run:

from RedDownloader.RedDownloader import DownloadVideosBySubreddit
from os import chdir

OUTPUT_PATH = r'C:\Users\samlb\Downloads\TESTING REDDIT'

chdir(OUTPUT_PATH)

DownloadVideosBySubreddit("Unity3D", 3, output=OUTPUT_PATH)

The files it extracts are:

image

Shouldn't it download 3 mp4 files?

Jackhammer9 commented 2 years ago

The three mp3 files are for different videos, so yes it should download three videos and then delete those temporary mp3 files.

samuelbraun04 commented 2 years ago

@JackhammerYT It's downloading the 3 videos, but everytime it downloads a video it replaces the previous video (since they're all named "Video.mp4". How can I make it so every video downloaded is named something unique?

And it's not deleting the .mp3 files after running (I can just delete them myself but just thought I'd mention that)

Jackhammer9 commented 2 years ago

Fixed in 3.3.0 releasing soon