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

Can't override '--cookies', causes downloads to fail in all modes other than Classic Mode #240

Closed
geofire opened this issue Jan 1, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@geofire
Copy link

geofire commented Jan 1, 2021

Thanks for taking the time to submit a bug report! Please include the following information:

What operating system are you using?

Windows 10 Pro, Version 10.0.18363 Build 18363

What version of Tartube are you using?

v2.3.042
This issue affects the latest versions of youtube-dl and youtube-dlc (at time of writing).

Issue

I'm attempting to download videos from LinkedIn Learning (LIL), of which I have a premium account, for offline viewing when I'm away from home, where internet connections are either slow or non-existent.

I've successfully used youtube-dl-gui for this, though am trying to use Tartube due to a few frustrating bugs in youtube-dl-gui.

As I have a premium account, I've followed ytdl-org/youtube-dl#20326 (comment) to work around youtube-dl's issue of not properly downloading videos from LIL because a premium account is required for the videos I'm downloading. So cookies and an identity header are required, as described in the link above. The fix above works successfully in youtube-dl-gui.

Tartube seems to ignore the --cookies command line option, whilst keeping it's own cookies.txt file which Tartube also seems to be unable to access. Oddly enough, downloads from LIL work completely fine in Classic Mode regardless of what command line options are used.

I cannot find where Tartube allows me to manually set or override the cookies.txt file, as Tartube seems to generate it's own. Apart from using the Command line options window in Download options there doesn't appear to be any way to override this.

When Tartube attempts to access the cookies.txt file it can't seem to be able to when downloading a video from a folder in Tartube, throwing [Errno 22] Invalid Argument in the terminal. Not using any additional command line options (apart from '--verbose') also causes Tartube to silently fail downloading. Duplicating the contents of the working cookie.txt file into Tartube's cookie.txt file doesn't work as Tartube for some reason can't access it.

Both cookie.txt files are exactly the same, as I'd copied the working file contents over into to Tartube's generated one.

Using the following commands in youtube-dl-gui works perfectly:
--verbose --cookies C:/cookies/cookies.txt --add-header "x-li-identity:<<identity header removed for privacy reasons>>"

Putting the same commands into Test System Command... for a single video also works correctly.

Troubleshooting

Overriding cookies.txt
Tartube downloads silently fail in the Output window (they just appear to hang), when trying to override the cookie.txt file. The terminal view shows the error thrown.
Note: there are two --cookie command line options in the Output window, as Tartube doesn't seem to recognise the '--cookie' command line option.

Test System Command

Using Test System Command... with the following command line options works correctly:
--verbose --cookies C:/cookies/cookies.txt --add-header "x-li-identity:<<identity header removed for privacy reasons>>"

Using Classic Mode

Classic Mode options

Output window after successful download from Classic Mode
Note: file path has changed here as I'd re-installed Tartube into a different location to check for permissions issues, which don't seem to be apparent. --cookies is also duplicated here, though Classic Mode works...

@geofire geofire added the bug Something isn't working label Jan 1, 2021
@axcore
Copy link
Owner

axcore commented Jan 1, 2021

From the first screenshot you provided, I would guess that your problem is nothing to do with cookies. The error message in the first screenshot occurs when Tartube tries to interpret the video's upload date, which causes a crash, presumably because LinkedIn is sending in invalid date.

All LinkedIn Video seems to be behind a paywall, so you can test this for yourself, and tell me what happens. Click Edit > System preferences... Output > Terminal window. Select the box Write output from downloader's STDOUT to the terminal window. Then de-select the box but don't write each video's JSON data.

Select a single video, right-click it and select Check video. The video's metadata should appear in the terminal window. You can either copy-paste the entire output, or you can find the value for upload_date, which should be near the top, and tell me that.

uploaddate

I can add a workaround for an invalid date, but it will be much easier if I don't have to guess what the invalid date is.

@axcore
Copy link
Owner

axcore commented Jan 1, 2021

By the way, a few months ago youtube-dl began writing the cookies.txt file to the same folder as the Tartube executable, so in response I now force youtube-dl to write it in the data folder, where it's easy for everyone to find.

It will be trivial to support a custom location for the cookies file, if that's necessary.

@geofire
Copy link
Author

geofire commented Jan 1, 2021

Hey @axcore thanks for your prompt response!

I had wondered that as I wasn't able to consistently reproduce the bug, and that Classic Mode worked. Though it seems the autonumber bug (the main one I was trying to avoid) is in youtube-dl rather than Tartube. Oh well.

Anyway, I've enabled those settings as you've requested though unfortunately Tartube doesn't output the raw JSON, it just throws that error.

Here's the output:


[debug] Loading archive file None

[debug] Default format spec: bestvideo+bestaudio/best

Exception in thread Thread-19:

Traceback (most recent call last):
File "C:/Users/[username]/AppData/Local/Tartube/msys64/mingw64/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
File "C:\Users\[username]\AppData\Local\Tartube\msys64\home\user\tartube\tartube/downloads.py", line 1042, in run
    self.run_video_downloader(media_data_obj)
File "C:\Users\[username]\AppData\Local\Tartube\msys64\home\user\tartube\tartube/downloads.py", line 1139, in run_video_downloader
    return_code = self.downloader_obj.do_download()
File "C:\Users\[username]\AppData\Local\Tartube\msys64\home\user\tartube\tartube/downloads.py", line 2810, in do_download
    dl_stat_dict = self.extract_stdout_data(stdout)
File "C:\Users\[username]\AppData\Local\Tartube\msys64\home\user\tartube\tartube/downloads.py", line 4455, in extract_stdout_data
    self.confirm_sim_video(json_dict)
File "C:\Users\[username]\AppData\Local\Tartube\msys64\home\user\tartube\tartube/downloads.py", line 3480, in confirm_sim_video
    upload_time = dt_obj.timestamp()
OSError: [Errno 22] Invalid argument

@axcore
Copy link
Owner

axcore commented Jan 1, 2021

Ok. I will apply a workaround, and we can work from there. It might be a day or two before I'm back at my desk, though.

@geofire
Copy link
Author

geofire commented Jan 1, 2021

All good, many thanks for your prompt response again!

axcore pushed a commit that referenced this issue Jan 4, 2021
@axcore
Copy link
Owner

axcore commented Jan 4, 2021

v2.3.045 contains the workaround. I have also updated the code, so that a custom location for the cookies file can be set (Edit > General download options... > Files > Cookies).

The update is only on git, so download it from here, and replace the old files in C:\Users[username]\AppData\Local\Tartube\msys64\home\user\tartube with the new ones.

Perhaps you can try the same test, and then we can find out what kind of date LinkedIn is trying to specify.

@axcore axcore closed this as completed Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants