Errors on Ubuntu 16.04
asolovyov03 opened this issue · 3 comments
I'm trying to use it in my program on Ubuntu 16.04 + Python3.9. On Windows it works good and stable but on Ubuntu it raises such erorrs:
Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.9/site-packages/TikTokAPI/tiktokapi.py", line 141, in getLikesByUserName user_data = self.getUserByName(user_name) File "/usr/local/lib/python3.9/site-packages/TikTokAPI/tiktokapi.py", line 114, in getUserByName return self.send_get_request(url, params) File "/usr/local/lib/python3.9/site-packages/TikTokAPI/tiktokapi.py", line 74, in send_get_request signature = self.tiktok_browser.fetch_auth_params(url, language=self.language) File "/usr/local/lib/python3.9/site-packages/TikTokAPI/tiktok_browser.py", line 54, in fetch_auth_params return asyncio.get_event_loop().run_until_complete(self.async_fetch_auth_params(url, language)) File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/usr/local/lib/python3.9/site-packages/TikTokAPI/tiktok_browser.py", line 57, in async_fetch_auth_params browser = await launch(self.options) File "/usr/local/lib/python3.9/site-packages/pyppeteer/launcher.py", line 306, in launch return await Launcher(options, **kwargs).launch() File "/usr/local/lib/python3.9/site-packages/pyppeteer/launcher.py", line 167, in launch self.browserWSEndpoint = get_ws_endpoint(self.url) File "/usr/local/lib/python3.9/site-packages/pyppeteer/launcher.py", line 226, in get_ws_endpoint raise BrowserError('Browser closed unexpectedly:\n') pyppeteer.errors.BrowserError: Browser closed unexpectedly:
OR
http.client.BadStatusLine: GET /json/version HTTP/1.1
Maybe I made something wrong but I didn't find any issue about it in this repo.
Thanks!
Same error, did you fix it ?
Unfortunately, I didn't.
I had same error @ CentOS
In my environment, the solution was to check the dependency packages and install them.
Errors:
Traceback (most recent call last):
File "main.py", line 6, in <module>
retval = api.getTrending(count=5)
File "/home/opc/tiktok_pj/tiktok/lib64/python3.6/site-packages/TikTokAPI/tiktokapi.py", line 104, in getTrending
return self.send_get_request(url, params)
File "/home/opc/tiktok_pj/tiktok/lib64/python3.6/site-packages/TikTokAPI/tiktokapi.py", line 74, in send_get_request
signature = self.tiktok_browser.fetch_auth_params(url, language=self.language)
File "/home/opc/tiktok_pj/tiktok/lib64/python3.6/site-packages/TikTokAPI/tiktok_browser.py", line 54, in fetch_auth_params
return asyncio.get_event_loop().run_until_complete(self.async_fetch_auth_params(url, language))
File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/home/opc/tiktok_pj/tiktok/lib64/python3.6/site-packages/TikTokAPI/tiktok_browser.py", line 57, in async_fetch_auth_params
browser = await launch(self.options)
File "/home/opc/tiktok_pj/tiktok/lib64/python3.6/site-packages/pyppeteer/launcher.py", line 307, in launch
return await Launcher(options, **kwargs).launch()
File "/home/opc/tiktok_pj/tiktok/lib64/python3.6/site-packages/pyppeteer/launcher.py", line 168, in launch
self.browserWSEndpoint = get_ws_endpoint(self.url)
File "/home/opc/tiktok_pj/tiktok/lib64/python3.6/site-packages/pyppeteer/launcher.py", line 227, in get_ws_endpoint
raise BrowserError('Browser closed unexpectedly:\n')
pyppeteer.errors.BrowserError: Browser closed unexpectedly:
Use the following code (test.py) to check for package dependencies.
Steadily until there are no more errors :)
from pyppeteer.launcher import Launcher
import os
cmd: str = " ".join(Launcher().cmd)
print(f'cmd: {cmd}')
os.system(cmd)
You should get an output like this.
$ python test.py
cmd: /home/opc/.local/share/pyppeteer/local-chromium/588429/chrome-linux/chrome --disable-background-networking --disable-background-timer-throttling --disable-breakpad --disable-browser-side-navigation --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=site-per-process --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-translate --metrics-recording-only --no-first-run --safebrowsing-disable-auto-update --enable-automation --password-store=basic --use-mock-keychain --headless --hide-scrollbars --mute-audio about:blank --remote-debugging-port=58451 --user-data-dir=/home/opc/.local/share/pyppeteer/.dev_profile/tmp85bn374t
/home/opc/.local/share/pyppeteer/local-chromium/588429/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory
Check for dependencies and install them.
$ yum whatprovides */libX11.so.6
$ sudo yum install -y libX11 nxagent
Repeat this process until you get no more errors...
In the end, I installed the following packages.
$ sudo yum install -y libX11 nxagent libcups.so.2 cups-libs libXScrnSaver pango atk at-spi2-atk gtk3
I hope it will be helpful, although the environment is different.