dfreelon / pyktok

A simple module to collect video, text, and metadata from Tiktok.
BSD 3-Clause "New" or "Revised" License
346 stars 45 forks source link

hashtag metadata error #67

Closed andrea-mar closed 2 months ago

andrea-mar commented 2 months ago

i am trying to get metadata for a specific hashtag with

pyk.save_tiktok_multi_page(HASHTAG,
                           ent_type='hashtag',
                           save_video=False,
                           metadata_fn=f'{HASHTAG}.csv',
                           browser_name='firefox')

When the following runs:

video_urls = asyncio.run(get_video_urls(tt_ent,
                                           ent_type,
                                     video_ct,
                                    headless))

I get:

RuntimeError: asyncio.run() cannot be called from a running event loop

dfreelon commented 2 months ago

Please post your IDE and OS... asyncio does not work with all IDEs.

andrea-mar commented 2 months ago

OS : windows IDE : VS code

dfreelon commented 2 months ago

Great. My advice is to try the code on a plain command line or Powershell and see if it makes any difference.

andrea-mar commented 2 months ago

thank you so much for the prompt responses!

i tried running it in the command line . it still errors


Lib\site-packages\playwright\_impl\_connection.py", line 514, in wrap_api_call
    raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.evaluate: ReferenceError: opts is not defined
    at Navigator.get [as userAgent] (<anonymous>:11:42)
    at eval (eval at evaluate (:234:30), <anonymous>:1:17)
    at UtilityScript.evaluate (<anonymous>:241:19)
    at UtilityScript.<anonymous> (<anonymous>:1:44)
dfreelon commented 2 months ago

That is a different error. I suggest you check here: https://github.com/dfreelon/pyktok/issues/63

andrea-mar commented 2 months ago

uninstall playwright and then reinstall playwright version = 1.37 and playwright install worked! Thank you for your super prompt responses 🥇 !