So, I've been reading the Youtube API--I'm interested in showing the three most recent videos uploaded by a user. But, as I've never navigated an API or done this kind of work before, I'm a bit confused by what exactly the API here is trying to tell me. What I DO understand is that if I enter a URL like the following:
https://gdata.youtube.com/feeds/api/users/aosjeff/uploads
Then I'll get a ton of information in a kind of list. What I don't understand is how to navigate that list in HTML, and make it return a link to the most recent video (or second most recent, etc) so that I can embed that video into the page. Can anyone explain this to me? Really appreciate the help!
Note: I'm working within site building software that will not allow me to use PHP or reference .php files.
Simon
You should look at parsing the xml data with php. This is probably the easiest way of doing things. Beginners tutorial here:
http://www.kirupa.com/web/xml_php_parse_beginner.htm
Related
I recently saw http://www.histography.io/ - system that uses HTML, CSS and Javascript to scan Wikipedia articles when you hover over a point and grabs the articled and the related youtube video so it can it be displayed to you.
I was exploring the system in the past two hours but can't seem to find the way it fetches the big data that it's in use.
Any pointers to the technique or functions used to fire the events in JS would be highly helpful.
In terms of how the videos are being rendered, it looks like there is a large manifest file with video Ids which I presume correspond to youtube video Ids. Refer to: http://www.histography.io/int.js
The main scripts are uglified so it's hard to tell you exactly what each function is doing.
For future reference I'd suggest checking out the network tab of a website in dev-tools to get a better understand of where resources are coming from.
Also when you request a wiki page it is making a request to a sever which takes the following inputs at the endpoint /wiki_page.php:
link
title
year
I have been searching hard on when a user pastes a link in the community page, and posts it. Then just below the link - a small image of the site and brief description of the site appears.
This is similar to when you post a link in Linkedin, and when you post it, then in the post automatically a small image of the website that this link points to appears, and also a brief descritption of the site, which I believe is the title.
I have searched a lot, but could not find a place to start on how to do this. If anyone can give me a starting point, it would be highly appreciated.
Best Regards,
This really would be highly valuable for all sorts of applications. Doing a quick SO and Google search, I found one service that has an API for this: https://www.url2png.com.
I'm not sure, but it would seem that this type of function would have to be done backend with software installed on your server. This makes sense as we're working with rendering images; and current browsers (through Javascript or APIs) don't yet seem to have the ability to render images. (Anyone provide links to documentation in the comments if I'm wrong about this?)
Update
Here's another one I found that has command-line open-source code: http://cutycapt.sourceforge.net/
Please forgive me for ranting, this one is giving me a headache...
RANT ON---Great pain with Google programming APIs. Trying to use Google APIs to communicate with YouTube to retrieve a list of my videos. Simple task. Version 2 APIs were easy to use, I had a sample working in 5 minutes. New Version 3 APIs are complex, tedious, require a bunch of advance setup and user account IDs, and after all that hassle, THEY STILL DO NOT WORK.---RANT OFF
C'mon Google, this is really hard to use!
Ok, down to business: I have an API key AND a Client Auth setup. Neither one works with my efforts to use Google's sample code.
Does anyone have a working sample where JAVASCRIPT in an HTML lists the videos in a YouTube account? Something where I can just substitute my account id and API key. Should be very simple, yes?
Thanks in advance for your help... and for bearing with me as I rant...
This sample from the offical docs works just fine. You just need to put your client ID in the OAUTH2_CLIENT_ID variable in auth.js. Make sure you're using the ID that's in the 'Client ID for web application' section in the Developers Console.
If you can't get it to work, be more specific about the error you're getting.
This question might not be suitable for this website and I am only asking this for information purposes..
So, please let me know if this is not suitable and I will delete it.
I have created a web application using PHP and Javascript.
what I want to do is to find a way to turn the entire thing into a small javascript code so I only give that piece of javascript code to the users and they can copy and paste it in their website in order to be able to use the application on their own website without being able to edit the contents of it!
could someone please advise on this?
Again, please let me know if this question is not suitable for this site and I will delete it.
There are two ways to go about this, make it available as an iframe widget (which could theoretically be injected through javascript) or make a cross-domain API with which the javascript would interface. From the sound of it going down the iframe route sounds most sensible, although it does come with a clickjacking vulnirability.
A few weeks ago I started learning Javascript and the Google Apps Script API, specifically in regard to spreadsheets. I have been trying to make a spreadsheet that fetches web pages and pulls stats about my friends for the game League of Legends. However, I have been running into a problem with the site I want to use, which is basically the only free LoL stats site that updates frequently. I'm not familiar at all with web development, but it seems when I try to access a page on lolking.net, for example http://www.lolking.net/summoner/na/60783 with Google's UrlFetchApp.fetch() it does not load the dynamic page. So instead of the final source, I get this which doesn't help me. Is there an easy way around this or would I simply have to use another website?
Thanks for thie info! Although it turns out I was mistaken. The UrlFetchApp was indeed returning the full source code, but I was using GAS's Logger to view the text. It seems the Logger has a length limit, so when I searched for the stats I wanted they weren't there simply because the source code got truncated. So, due to an oversight on my part, I never had a problem in the first place. For other people reading this question, in the end I have no idea how UrlFetchApp works with dynamic pages using clientside js (you'd probably want to talk to the poster below or post a new question).
You are getting fhe raw html page with clientside js included. That wont work from any system not just gas. You need to debug that page js and find where it does an ajax call to get the data you want.
Then do the same from your gas. Might not work if the call is authenticated etc.