ReVanced / restore-missing-youtube-watch-history

⌛ Script to import missing YouTube watch history
https://revanced.app
GNU General Public License v3.0
58 stars 6 forks source link

Error while restoring watch history #3

Closed mjain234 closed 7 months ago

mjain234 commented 7 months ago

I have been trying to restore the YouTube watch history via Termux through the guide you provided but seems like in the end, it gives me an error

Found 18394 videos to watch Found 18258 videos to watch after de-duplication Traceback (most recent call last): File "/storage/emulated/0/Download/Compressed/Revanced/restore-missing-youtube-watch-history-main/main.py", line 210, in main() File "/storage/emulated/0/Download/Compressed/Revanced/restore-missing-youtube-watch-history-main/main.py", line 109, in main download_videos(kept, DONE_DIRECTORY, SLEEP_MIN, File "/storage/emulated/0/Download/Compressed/Revanced/restore-missing-youtube-watch-history-main/main.py", line 176, in download_videos with yt_dlp.YoutubeDL(opts) as ydl: ^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 687, in init self._request_director = self.build_request_director(_REQUEST_HANDLERS.values(), _RH_PREFERENCES) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4128, in build_request_director cookiejar=self.cookiejar, ^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.11/functools.py", line 1001, in get val = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4049, in cookiejar return load_cookies( ^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/yt_dlp/cookies.py", line 91, in load_cookies extract_cookies_from_browser(browser_name, profile, YDLLogger(ydl), keyring=keyring, container=container)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/yt_dlp/cookies.py", line 112, in extract_cookies_from_browser return _extract_chrome_cookies(browser_name, profile, keyring, logger) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/yt_dlp/cookies.py", line 273, in _extract_chrome_cookies raise FileNotFoundError(f'could not find {browser_name} cookies database in "{search_root}"') FileNotFoundError: could not find chrome cookies database in "/data/data/com.termux/files/home/.config/google-chrome"

Here is the screenrecord of the same: https://github.com/ReVanced/restore-missing-youtube-watch-history/assets/70900505/6a8b4c8b-d9dd-433d-aa5a-f85f6552d514

oSumAtrIX commented 7 months ago

The guide is made for Windows as evident from the screenshots because I have no idea how to get the cookies in Termux. Unless there's a way to somehow login to YouTube or get the Cookies in Termux, I'm not sure how to fix this

indrastorms commented 7 months ago

The guide is made for Windows as evident from the screenshots because I have no idea how to get the cookies in Termux. Unless there's a way to somehow login to YouTube or get the Cookies in Termux, I'm not sure how to fix this

We can obtain cookies but how to supply? I can see there is an arg, is it take as file or string?

indrastorms commented 7 months ago

Fixed by manually suppling the cookies obtained with firefox addon. Just need to use use cookiefile instead of cookiesfrombrowser in opts. Then run python main.py --cookiesfrombrowser cookie.txt

oSumAtrIX commented 7 months ago

Can you please PR the steps/code?

indrastorms commented 7 months ago

I don't know how to stucture code with two cookies opts. I'm pasting the code, you reorganize it 😅

indrastorms commented 7 months ago

Can you please PR the steps/code?

Now don't blame me if you get headache while seeing this shity code. #4