Closed ponponon closed 10 months ago
The error micawber.exceptions.ProviderNotFoundException #110 occurs when attempting to use Micawber library for the URL https://juejin.cn/post/7243725952788807717. This error indicates that the library doesn't have a registered provider to handle content from this URL.
Verify Provider Support: Check if Micawber library supports the specific URL provider (https://juejin.cn). It might lack support for this provider.
Update Micawber: Ensure you're using the latest version of the Micawber library. Newer versions might include support for additional providers or fixes for provider handling issues.
Custom Provider: If Micawber doesn't support the desired provider, consider creating a custom provider implementation for https://juejin.cn to handle the content embedding.
Implement error handling in your code to catch the ProviderNotFoundException specifically and provide alternative actions or messages for unsupported URLs.
import micawber
from loguru import logger
from micawber.exceptions import ProviderNotFoundException
try:
providers = micawber.bootstrap_basic()
url = 'https://juejin.cn/post/7243725952788807717'
logger.debug(providers.request(url))
except ProviderNotFoundException as e:
logger.error(f"Provider not found for URL: {url}. Error: {e}")
# Handle the exception as needed, e.g., print an error message or take alternative actions.
Consider updating your pip version to the latest release (23.3.1) by running:
pip install --upgrade pip
@ponponon - the list of providers out-of-the-box for the "basic" bootstrap is here and the docs are pretty clear about what happens if you request a URL that does not have a provider: https://micawber.readthedocs.io/en/latest/api.html#micawber.providers.ProviderRegistry.request
What you need to do is either:
juejin.cn
URL and returns the appropriate oEmbed metadata.Looking at noembed and embed.ly, neither of them support juejin.cn so you will need to write your own custom provider for that website.
macos