pavelk2 / social-feed

JavaScript plugin that shows a user feed from the most popular social networks
http://pavelk2.github.io/social-feed-example/
MIT License
962 stars 304 forks source link

Load attachment thumbnail to template #166

Open vojtasvoboda opened 8 years ago

vojtasvoboda commented 8 years ago

With this tiny change, you can use RSS channel to load YouTube videos without API and API KEY. After that you are able to load video thumbnail in template like that:

<a href="{{=it.link}}" target="_blank">
    <img src="{{=it.attachment_thumbnail}}" alt=""{{=it.title}}>
</a>

YouTube RSS channel link is in that format: https://www.youtube.com/feeds/videos.xml?channel_id=UCsFctXdFnbeoKpLefdEloEQ

So JS will be:

$('.youtube-feed').socialfeed({
    rss: {
        urls: ['https://www.youtube.com/feeds/videos.xml?channel_id=UCkhimgIt9ib6NXkIjHfVnVA'],
        limit: 3
    },
    length: 200,
    show_media: true,
    template_html:
        '<a href="{{=it.link}}" target="_blank"> \
            <img src="{{=it.attachment_thumbnail}}"> \
        </a>'
});
vojtasvoboda commented 7 years ago

Freshly updated from master (gh-pages) branch.

vojtasvoboda commented 7 years ago

Hello? Anybody there? :-)

martijngastkemper commented 7 years ago

YouTube specific code is not allowed in the general RSS option. You have to add YouTube as a separate social network. Like proposed in #160.