coleifer / micawber

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

500px and bootstrap_embedly #38

Closed ad-m closed 9 years ago

ad-m commented 9 years ago
In [3]: requests.get('http://api.embed.ly/1/oembed?url=https%3A%2F%2Fiso.500px.com%2Fguest-curator-joel-julius-tjintjelaar-reveals-three-photographers-that-should-have-a-larger-following%2F&maxwidth=500').json()
Out[3]: 
{u'author_name': u'DL Cade',
 u'author_url': u'https://iso.500px.com/author/dl/',
 u'description': u"One of December's talented 500px Guest Curators was photographer Joel (Julius) Tjintjelaar , and he fully embraced the real purpose of the Editors' Choice section: to unveil photos and photographers that might not have made the Popular page for one reason or another... but probably should have.",
 u'provider_name': u'500px',
 u'provider_url': u'https://iso.500px.com',
 u'thumbnail_height': 1000,
 u'thumbnail_url': u'https://isocdn.500px.org/wp-content/uploads/2014/12/julius-1500x1000.jpg',
 u'thumbnail_width': 1500,
 u'title': u'Guest Curator Joel (Julius) Tjintjelaar Reveals Three Photographers that Should Have a Larger Following',
 u'type': u'link',
 u'url': u'https://iso.500px.com/guest-curator-joel-julius-tjintjelaar-reveals-three-photographers-that-should-have-a-larger-following/',
 u'version': u'1.0'}

In [4]: bootstrap_embedly().request('http://iso.500px.com/guest-curator-joel-julius-tjintjelaar-reveals-three-photographers-that-should-have-a-larger-following/')
---------------------------------------------------------------------------
ProviderNotFoundException                 Traceback (most recent call last)
<ipython-input-4-aca3a4c8cf6f> in <module>()
----> 1 bootstrap_embedly().request('http://iso.500px.com/guest-curator-joel-julius-tjintjelaar-reveals-three-photographers-that-should-have-a-larger-following/')

/tmp/micawber/local/lib/python2.7/site-packages/micawber/providers.pyc in inner(self, url, **params)
     91                 self.cache.set(key, data)
     92             return data
---> 93         return fn(self, url, **params)
     94     return inner
     95 

/tmp/micawber/local/lib/python2.7/site-packages/micawber/providers.pyc in request(self, url, **params)
    132         if provider:
    133             return provider.request(url, **params)
--> 134         raise ProviderNotFoundException('Provider not found for "%s"' % url)
    135 
    136 

ProviderNotFoundException: Provider not found for "http://iso.500px.com/guest-curator-joel-julius-tjintjelaar-reveals-three-photographers-that-should-have-a-larger-following/"
ad-m commented 9 years ago
In [14]: requests.get('http://api.embed.ly/1/oembed?url=https%3A%2F%2Fwww.screenr.com%2FUuv7&maxwidth=500').json()
Out[14]: 
{u'author_name': u'joe_deegan',
 u'author_url': u'https://www.screenr.com/user/joe_deegan',
 u'description': u'How to bring users back to #Moodle after completing an #Articulate course',
 u'height': 308,
 u'html': u'<iframe class="embedly-embed" src="//cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.screenr.com%2FUuv7&src=https%3A%2F%2Fwww.screenr.com%2Fembed%2FUuv7&image=https%3A%2F%2Faz21792.vo.msecnd.net%2Fimages%2F71d35042-a5dc-46b6-b212-a4175f3d4ff7_thumb.jpg&type=text%2Fhtml&schema=screenr" width="500" height="308" scrolling="no" frameborder="0" allowfullscreen></iframe>',
 u'provider_name': u'screenr',
 u'provider_url': u'https://www.screenr.com',
 u'thumbnail_height': 110,
 u'thumbnail_url': u'https://az21792.vo.msecnd.net/images/71d35042-a5dc-46b6-b212-a4175f3d4ff7_thumb.jpg',
 u'thumbnail_width': 190,
 u'title': u'How to bring users back to #Moodle after completing an #Articulate course',
 u'type': u'video',
 u'version': u'1.0',
 u'width': 500}

In [15]: bootstrap_embedly().request('https://www.screenr.com/Uuv7')
---------------------------------------------------------------------------
ProviderNotFoundException                 Traceback (most recent call last)
<ipython-input-15-18720691b7e4> in <module>()
----> 1 bootstrap_embedly().request('https://www.screenr.com/Uuv7')

/tmp/micawber/local/lib/python2.7/site-packages/micawber/providers.pyc in inner(self, url, **params)
     91                 self.cache.set(key, data)
     92             return data
---> 93         return fn(self, url, **params)
     94     return inner
     95 

/tmp/micawber/local/lib/python2.7/site-packages/micawber/providers.pyc in request(self, url, **params)
    132         if provider:
    133             return provider.request(url, **params)
--> 134         raise ProviderNotFoundException('Provider not found for "%s"' % url)
    135 
    136 

ProviderNotFoundException: Provider not found for "https://www.screenr.com/Uuv7"
ad-m commented 9 years ago

Interesting...By analysis http://api.embed.ly/1/services/python we can't found 500px and screenr don't have support for www.

ad-m commented 9 years ago

zaznaczenie_497 So interesting results of small analysis.

coleifer commented 9 years ago

I don't see a provider for 500px when bootstrapping from embedly. Not sure what to tell you.

You can always just manually add new providers by calling ProviderRegistry.register, so if you're using one of the 3rd party bootstrap functions and don't see what you need, just manually add the regex.

iparamonau commented 9 years ago

Hi guys, happy new year! And sorry to cut in, I am just following 'oembed' on GitHub to see what's happening.

How about adding Iframely as provider? We support pretty much every provider out there, and even more so. Over 1600 of them. Plus deliver summary cards for the rest URLs.

All via oEmbed, so should be straightforward. We even have open source api so that you can have a definite endpoint in your lib.

Here's an example for above Screener and summary card for 500px ISO

Cheers, Ivan

coleifer commented 9 years ago

@iparamonau -- I think it would be more appropriate to open a new ticket, as this ticket is (besides being closed) unrelated to your request. I also do not see anything in the docs about a schema or provider list. The supported providers all have an endpoint that lists regular expressions. For example:

http://noembed.com/providers

iparamonau commented 9 years ago

@coleifer will do, thanks. I guess I was just suggesting the solution as 500px ISO doesn't have native oEmbeds and require a custom parser.