coleifer / micawber

a small library for extracting rich content from urls
http://micawber.readthedocs.org/
MIT License
635 stars 91 forks source link

Issue with player.vimeo.com urls #104

Closed dorianfm closed 3 years ago

dorianfm commented 3 years ago

If a player.vimeo.com url is used micawber cannot find a provider. eg:

>>> import micawber
>>> providers = micawber.boostrap_basic()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'micawber' has no attribute 'boostrap_basic'
>>> providers = micawber.bootstrap_basic()
>>> providers.request('https://player.vimeo.com/video/561760257/');
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/srv/sites/gasworks.org.uk/lib/python3.8/site-packages/micawber/providers.py", line 111, in inner
    return fn(self, url, **params)
  File "/srv/sites/gasworks.org.uk/lib/python3.8/site-packages/micawber/providers.py", line 155, in request
    raise ProviderNotFoundException('Provider not found for "%s"' % url)
micawber.exceptions.ProviderNotFoundException: Provider not found for "https://player.vimeo.com/video/561760257/"
>>> providers.request('https://player.vimeo.com/video/561760257/')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/srv/sites/gasworks.org.uk/lib/python3.8/site-packages/micawber/providers.py", line 111, in inner
    return fn(self, url, **params)
  File "/srv/sites/gasworks.org.uk/lib/python3.8/site-packages/micawber/providers.py", line 155, in request
    raise ProviderNotFoundException('Provider not found for "%s"' % url)
micawber.exceptions.ProviderNotFoundException: Provider not found for "https://player.vimeo.com/video/561760257/"
>>> providers.request('https://vimeo.com/video/561760257/')
{'type': 'video', 'version': '1.0', 'provider_name': 'Vimeo', 'provider_url': 'https://vimeo.com/', 'title': 'Erauso: The Inner Experience', 'author_name': 'Gasworks', 'author_url': 'https://vimeo.com/gasworkslondon', 'is_plus': '1', 'account_type': 'plus', 'html': '<iframe src="https://player.vimeo.com/video/561760257?app_id=122963" width="426" height="240" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen title="Erauso: The Inner Experience"></iframe>', 'width': 426, 'height': 240, 'duration': 674, 'description': '', 'thumbnail_url': 'https://i.vimeocdn.com/video/1161137198_295x166', 'thumbnail_width': 295, 'thumbnail_height': 166, 'thumbnail_url_with_play_button': 'https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1161137198_295x166&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png', 'upload_date': '2021-06-11 07:13:16', 'video_id': 561760257, 'uri': '/videos/561760257', 'url': 'https://vimeo.com/video/561760257/'}

will submit PR to resolve this issue.

coleifer commented 3 years ago

For what its worth Vimeo's oEmbed docs do not mention player.vimeo.com as one of the supported url formats: https://developer.vimeo.com/api/oembed/videos

coleifer commented 3 years ago

Fixed.