davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.69k stars 952 forks source link

ERROR: No matching distribution found for playwright (from TikTokApi) #360

Closed mengguiyouziyi closed 3 years ago

mengguiyouziyi commented 3 years ago

Describe the error

My English is not good, you can see blow.

The buggy code

pip install TikTokApi --upgrade

Error Trace (if any)

Collecting TikTokApi
  Using cached TikTokApi-3.7.9.tar.gz (55 kB)
Requirement already satisfied, skipping upgrade: requests in ./anaconda3/envs/aispider/lib/python3.6/site-packages (from TikTokApi) (2.23.0)
ERROR: Could not find a version that satisfies the requirement playwright (from TikTokApi) (from versions: none)
ERROR: No matching distribution found for playwright (from TikTokApi)

Desktop (please complete the following information):

Additional context

try1: pip install playwright -- upgrade

ERROR: Could not find a version that satisfies the requirement playwright (from versions: none)
ERROR: No matching distribution found for playwright

try2: npm i -D playwright

> playwright@1.6.1 install /search/odin/meng/node_modules/playwright
> node install.js

(node:121287) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, mkdir '/search/odin/meng/.cache/ms-playwright'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:121287) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:121287) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
npm WARN saveError ENOENT: no such file or directory, open '/search/odin/meng/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/search/odin/meng/package.json'
npm WARN ws@7.4.0 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.4.0 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN meng No description
npm WARN meng No repository field.
npm WARN meng No README data
npm WARN meng No license field.

+ playwright@1.6.1
added 37 packages from 83 contributors in 3.811s

3 packages are looking for funding
  run `npm fund` for details

try 3: pip install TikTokApi-pyppeteer I write

from TikTokApi import TikTokApi
api = TikTokApi(debug=True)

results = 10

trending = api.trending(count=results)

for tiktok in trending:
    # Prints the id of the tiktok
    print(tiktok['id'])

print(len(trending))

to test.py. when I python test.py, I got this code:

Class initialized
[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a few minutes.
The following error occurred, but it was ignored.
'browser' object has no attribute 'timezone_name'
[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a few minutes.
Traceback (most recent call last):
  File "test.py", line 6, in <module>
    trending = api.trending(count=results)
  File "/search/odin/meng/anaconda3/envs/aispider/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 222, in trending
    res = self.getData(b, **kwargs)
  File "/search/odin/meng/anaconda3/envs/aispider/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 107, in getData
    query = {"verifyFp": b.verifyFp, "did": b.did, "_signature": b.signature}
AttributeError: 'browser' object has no attribute 'signature'
jp-wagner commented 3 years ago

With the pyppeteer version, try adding a custom verifyFp cookie (like so https://github.com/davidteather/TikTok-Api/pull/342#issuecomment-727009300). It should look something like:

from TikTokApi import TikTokApi
api = TikTokApi(debug=True)

results = 10

trending = api.trending(count=results, custom_verifyFp="your_cookie")

for tiktok in trending:
    # Prints the id of the tiktok
    print(tiktok['id'])

print(len(trending))
mengguiyouziyi commented 3 years ago

With the pyppeteer version, try adding a custom verifyFp cookie (like so #342 (comment)). It should look something like:

from TikTokApi import TikTokApi
api = TikTokApi(debug=True)

results = 10

trending = api.trending(count=results, custom_verifyFp="your_cookie")

for tiktok in trending:
    # Prints the id of the tiktok
    print(tiktok['id'])

print(len(trending))

Q1: if I not use pyppeteer, how can I resolve this issue, like this ERROR: No matching distribution found for playwright (from TikTokApi) Q2: what difference between TikTokApi() and TikTokApi.get_instence()? Q3: I add cookie like this trending = api.trending(count=results, custom_verifyFb='verify_khg0pb1s_aQs4uSWx_g3NC_4ToC_A9f2_dYgkITkKcyab') but I get the same result AttributeError: 'browser' object has no attribute 'signature'

hoylemd commented 3 years ago

I'm running into the same issue when I try to install playwright in a docker container with certain python versions. I can get it to install when I have python 3.8.5 installed, but not 3.8.0 or 3.9.0.

What version of python are you running @mengguiyouziyi ?

python --version If you don't know how to get that easily

cesarblancg commented 3 years ago

I'm running into the same issue when I try to install playwright in a docker container with certain python versions. I can get it to install when I have python 3.8.5 installed, but not 3.8.0 or 3.9.0.

What version of python are you running @mengguiyouziyi ?

python --version If you don't know how to get that easily

Me too, but with the pypeeter version. I solved it downloading with curl the TikTokApi file from pypi and doing "pip install file" on Dockerfile.

jp-wagner commented 3 years ago

Regarding Q3 it should be "custom_verifyFp" not "custom_verifyFb". Let me know if that fixes it for puppeteer!

mengguiyouziyi commented 3 years ago

I'm running into the same issue when I try to install playwright in a docker container with certain python versions. I can get it to install when I have python 3.8.5 installed, but not 3.8.0 or 3.9.0.

What version of python are you running @mengguiyouziyi ?

python --version If you don't know how to get that easily

Python 3.6.2 :: Continuum Analytics, Inc. I change it to python3.7.4, pip install TikTokApi --upgrade is succeed. thanks. see blow: https://github.com/davidteather/TikTok-Api/issues/360#issuecomment-728652991

mengguiyouziyi commented 3 years ago

Regarding Q3 it should be "custom_verifyFp" not "custom_verifyFb". Let me know if that fixes it for puppeteer!

  1. I change it to python3.7.4, pip install TikTokApi --upgrade is succeed.
  2. pip install TikTokApi-pyppeteer is succeed too, and I run
    
    from TikTokApi import TikTokApi
    api = TikTokApi(debug=True)

results = 10

trending = api.trending(count=results, custom_verifyFp='verify_khg0pb1s_aQs4uSWx_g3NC_4ToC_A9f2_dYgkITkKcyab')

for tiktok in trending:

Prints the id of the tiktok

print(tiktok['id'])

print(len(trending))

the result is:

Class initialized [W:pyppeteer.chromium_downloader] start chromium download. Download may take a few minutes. 100%|█████████████████████████████████████████████████████████████| 108773488/108773488 [00:12<00:00, 8662063.86it/s] [W:pyppeteer.chromium_downloader] chromium download done. [W:pyppeteer.chromium_downloader] chromium extracted to: /search/odin/meng/.local/share/pyppeteer/local-chromium/588429 The following error occurred, but it was ignored. 'browser' object has no attribute 'timezone_name' Traceback (most recent call last): File "test.py", line 6, in trending = api.trending(count=results, custom_verifyFp='verify_khg0pb1s_aQs4uSWx_g3NC_4ToC_A9f2_dYgkITkKcyab') File "/search/odin/meng/anaconda3/envs/tiktok-api-pyppeteer/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 222, in trending res = self.getData(b, **kwargs) File "/search/odin/meng/anaconda3/envs/tiktok-api-pyppeteer/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 107, in getData query = {"verifyFp": b.verifyFp, "did": b.did, "_signature": b.signature} AttributeError: 'browser' object has no attribute 'signature' Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/search/odin/meng/anaconda3/envs/tiktok-api-pyppeteer/lib/python3.7/site-packages/pyppeteer/launcher.py", line 151, in _close_process self._loop.run_until_complete(self.killChrome()) File "/search/odin/meng/anaconda3/envs/tiktok-api-pyppeteer/lib/python3.7/asyncio/base_events.py", line 555, in run_until_complete self._check_closed() File "/search/odin/meng/anaconda3/envs/tiktok-api-pyppeteer/lib/python3.7/asyncio/base_events.py", line 475, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed sys:1: RuntimeWarning: coroutine 'Launcher.killChrome' was never awaited RuntimeWarning: Enable tracemalloc to get the object allocation traceback Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/search/odin/meng/anaconda3/envs/tiktok-api-pyppeteer/lib/python3.7/site-packages/pyppeteer/launcher.py", line 151, in _close_process self._loop.run_until_complete(self.killChrome()) File "/search/odin/meng/anaconda3/envs/tiktok-api-pyppeteer/lib/python3.7/asyncio/base_events.py", line 555, in run_until_complete self._check_closed() File "/search/odin/meng/anaconda3/envs/tiktok-api-pyppeteer/lib/python3.7/asyncio/base_events.py", line 475, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed

davidteather commented 3 years ago

See this comment as your main issue is now AttributeError: 'browser' object has no attribute 'signature'