Get img thumbnails from Yahoo! Screen Video Player

2019-04-10 17:01发布

问题:

I am trying to get yahoo! screen video's image thumbs to embed on my website like we can easily do in other websites ( Get img thumbnails from Vimeo?, How do I get a YouTube video thumbnail from the YouTube API?, etc.).

There used to be a sugestion: Get thumbnail image for Yahoo video? (python) but it doesn't seem to work now with the new Yahoo! Screen.

Some quick searching on the Internets led me to Y!'s very own online help: http://help.yahoo.com/l/in/yahoo/video/using/using005.html;_ylt=Aj3rNfbhKBNyXODHGK5ONSo1qXtG

According to which, all I have to do is Copy the thumbnail code under the Share tab. Unfortunately, I can't seem to find any thumbnail code under the Share tab.

I also couldn't find any Y!Screen api on http://developer.yahoo.com/everything.html that could help me with this... ideas?

回答1:

Using YQL for cross domain data scraping along with jQuery is the solution that works.

Some of it is sound, some of it is hackish, but that's what scraping is all about I suppose.

The basis for this method was not done by me, but by using a tutorial for Facebook titled Create a Facebook-style Link Preview Using jQuery & YQL written by Jocelyn Stretton.

Included in the modified JavaScript which serves as a starting point, you will have access and understand how to retrieve the following:

1. Yahoo! Screen Video Webpage Title
2. Yahoo! Screen Thumbnail URL Link
3. Yahoo! Screen Video URL Link
4. Scrape Other meta Tag Content
5. Yahoo Screen Video Embed Code provided by the Yahoo Screen Player itself.

DEMO in jsFiddle!

EDIT: jsFiddle DEMO is no longer subdomain (regionally) dependent for video example.

EDIT 2: For those that would like to see another tutorial based on this .ajax() YQL process, I've made two jsFiddles for Pinterest Data Scraping. You can see that SO Answer here that discusses a lot more in detail for XPATH.