I'm using the YouTube API (v2) and can't find a reliable way of linking to a users youtube page.
If they are a normal user then I can put their username in the URL such as:
http://www.youtube.com/user/user-NAME-goes-here
But if its a channel then the username seeems to come back as a garbled mess and doesn't work. I've found that you can put "UC" in front of the user ID and change /user/ to /channel/ as follows:
http://www.youtube.com/channel/user-ID-goes-here
But how do I know if its a channel or a normal user so I make the adjustment?
Related
Hi,
I am using this URL to get feed from my youtube account
http://www.youtube.com/embed/?listType=user_uploads&list=
you have to put your user name at the end. However, my account is rather new and I dont know what my user name is. So I went to my settings and under user ID there is a long unintelligible word which I didnt chose. I tried that and didnt work.
I then tried with an older account I have and it actually shows an user name on my profile page which I remember I chose when I created the account. I tried the feed with that one and it does work so does it mean newer accounts dont have a user name?? How can I use the feed URL then?
Thank you.
If you want get the feed from a youtube channel, you can use this link:
https://www.youtube.com/feeds/videos.xml?channel_id=<channel_id>
or
https://www.youtube.com/feeds/videos.xml?user=<user_name>
Where you have to change for a valid channel_id or accordingly.
Examples:
https://www.youtube.com/feeds/videos.xml?user=Microsoft
https://www.youtube.com/feeds/videos.xml?channel_id=UCE_M8A5yxnLfW0KghEeajjw (Apple Inc.)
I need to fetch YouTube video comments with YouTube API, but it seems that must login in web page at first time. Is there any way to access YouTube video comment API without webpage login? I don't like to click the login button or any thing in web page manually.
You don't need to be authenticated with OAuth to return a thread of comments from a video. You just need an API key. Hit the commentThreads/list endpoint with the following parameters:
part -> id,snippet
videoId -> jCHE0Tjw6MA (or the video ID you want to return the comments for)
HTTP GET https://www.googleapis.com/youtube/v3/commentThreads?part=id%2Csnippet&videoId=jCHE0Tjw6MA&key={YOUR_API_KEY}
I'm developing a desktop application which is supposed to allow users to login via Twitter.
There seems to be 2 ways to do so, that differ in a way oauth_verifier is returned to the application.
The first one is for web applications and oauth_verifier is returned as a url query parameter when redirecting user back to redirect_url.
The second one is using a PIN displayed to the user, which user enters to the app.
Now Facebook, for example, has a page facebook.com/connect/login_success.html , where FB can redirect a user with ouath_verifier as a query param (e.g. facebook.com/connect/login_success.html?code=<token>. Then I can read that param back from the browser's location field (I'm using an embedded browser).
So, is such a workflow possible with Twitter? Does it have a static page, where it can redirect user with oauth_verifier ?
I haven't been able to find such a page in Twitter's API docs, so I ended up using the main page twitter.com for the redirect. Everything works fine.
From the Twitter API I obtain user's ID (of course beside profile link, username etc). How can I display the link to user's profile according his ID?
For example, Facebook API provide user's ID as well, and if I put to the browser www.facebook.com/users_id, I'll get his profile...
Is there any way to do with Twitter? www.twitter.com/users_id returns empty page...
EDIT: obviously I can save user's URL (or his username), but the respective user can whenever change it...
what do you call a twitter "profile" ? I guess you talk about the user timeline
according to the api doc, your url should probably look like this :
https://api.twitter.com/1/statuses/user_timeline.html?&user_id=(your_id_here)
however, i would advise to use one of the twitter api gems to ease your pain...
I'm building a music website on Symfony 1.4 and Doctrine 1.2. I'm trying to integrate facebook plugins (like, send, post a message buttons) on my pages. For example, I want users to be able to like a song on a song page in my song module. But the problem is, I've used sfDoctrineGuard to secure all modules on my app except for the landing page. So if a user logs in and uses the facebook like button to like a song on the song page, because that song module is secured by sfGuardAuth, facebook API can't talk to it and gets forwarded to the landing page. This means that all likes on my app get posted on facebook activity feed as if the user liked my landing page.
Is there a way to build an exception into sfGuard so that any traffic coming from facebook domain can access that page? Is there a workaround to this? I want to be able to show all the facebook meta data from my secured pages, for whichever song is liked, on a facebook wall. If I disable all sfGuard security, it works fine.
Any help would be great as I'm stumped and haven't found any one else with this problem.
Well, it could be a huge security hole if you want to allow request from Facebook to be able to by pass your sfGuard security. If someone click that link on Facebook, it will also have access to your website without having to be logged in.
You might find a work around by tweaking the Facebook bot who scrape your page. The user agent of the scraper is: "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)". So it could be easy to allow access to its request by looking at the user agent. BUT, any one can spoof a user agent easily today.
Maybe you have to find an other way. I though about a kind of light page wich can be accessible for every one and where you display the minimum information (like only the artist and the song name without being able to play it. But just to be sure that, if someone not logged in try to see the page, it won't be redirect to the login page but to this light page. You get the point?
Then, you can put a huge button to allow new people to register to see the full page.
Anyway, in any case you will find, you should implement it using filter (in filters.yml). Filters are executed before any action. So it's the perfect place for this kind of check.
You will find info about filters:
on the official website (they are 2 links)
here an implementation of a ssl requirement (sorry a googlecache page)
here a basic implementation
edit:
I will go on sth like that. First, create a user called "facebook bot", and put its id in the /apps/frontend/config/app.yml:
all:
facebook_bot_id: 56 // sf_guard_user_id
Then create a simple filter lib/filter/facebookBotFilter.php
<?php
class facebookBotFilter extends sfFilter
{
public function execute ($filterChain)
{
$context = $this->getContext();
$controller = $context->getController();
$request = $context->getRequest();
$user = $context->getUser();
// get the user agent
$pathArray = $request->getPathInfoArray();
$useragent = isset($pathArray['HTTP_USER_AGENT']) ? $pathArray['HTTP_USER_AGENT'] : '';
if (preg_math('/facebookexternalhit', $useragent))
{
$member = Doctrine_Core::getTable('sfGuardUser')->find(sfConfig::get('app_facebook_bot_id'));
// logged in the facebook bot
$user->signIn($member);
}
// execute next filter
$filterChain->execute();
}
}
Don't forget to enabled the filter in apps/frontend/config/filters.yml:
rendering: ~
facebookBotFilter:
class: facebookBotFilter
security: ~