How to make this GET show the link url? - php

I have:
https://gdata.youtube.com/feeds/base/users/machinima/uploads?fields=item(title,pubDate)&orderby=updated&alt=rss&client=ytapi-youtube-rss-redirect&v=2
I would like this to show the link element of the RSS feed too.
Adding item(title,pubDate,link) does not seem to work.
What am I doing wrong?
EDIT: I would like this to only get title,pubDate,link and not the entire feed (for bandwith reasons), hence the problem. Sorry if that was not clear.

You have to replace the item(title,pubDate) part directly after the ?fields= key:
https://gdata.youtube.com/feeds/base/users/machinima/uploads?fields=item(title,pubDate,link)&orderby=updated&alt=rss&client=ytapi-youtube-rss-redirect&v=2
--------------------------------------------------------------------^

Related

PHP: How to get the main content of a website given by a RSS feed?

I read some RSS feeds and they give as Text/News only a short peace of the Original Message.
I tried to take the given URL to original Article and try to get the content.
But i don't know how i can extract the relevant text part of the page.
Without Menu, Advertising, footer text etc.
Has anybody a idea how i can make this better?
Maybe there exists a PHP library which do this very good?
For example Facebook makes here a good job, when i post a link of my Websites (without any Facebook specific code), they detect the relevantt text part automatically.
Hope someone can help me a little bit.

Getting different feeds from one URL

i am trying to get some data(stats) from a specific YouTube channel. For this i am using following URL:
https://gdata.youtube.com/feeds/api/channels/rX3yH7nFEQq49lQGVk2Iqg?v=2
When i enter this URL directly into FireFox Addressbar i get the result i am looking for. BUT
if i open the exact same URL with:
$data = simplexml_load_file('https://gdata.youtube.com/feeds/api/channels/rX3yH7nFEQq49lQGVk2Iqg?v=2');
i get a completly different result(using print_r($data))!
Is there an explanation for this? Are i am doing something wrong? Is there something missing?
Thank you!
The most useful information about a channel will actually come from the /users/ service, not the /channels/.
You could also add in alt=json, unless you really like parsing XML instead of working with JSON.
Finally, the "correct" form for a channel id has a UC prefix, though v2 supports channel ids without the prefix as well.
Putting that all together gives you https://gdata.youtube.com/feeds/api/users/UCrX3yH7nFEQq49lQGVk2Iqg?v=2&alt=json
(leave out alt=json to work with simplexml_load_file())

Trying to find a "backdoor" to the number of shares/+1's/stumbles a website has

I need to access the number of facebook shares, google +1's, stumbles for a given website. My first thought was to use file_get_contents on the url of the button alone, removing everything but the number but in hindsight, the number is gotten using javascript so I sanitized out the html and left the javascript. I've managed to find a url for twitter:
http://cdn.api.twitter.com/1/urls/count.json?url=[put encoded url here]
This returns a json object as follows:
{"count":52,"url":"[url here"}
I have gone over the code for the buttons for hours using firebug but I'm not that great at Javascript so sometimes I'm not even sure what I'm looking at. Anybody have any ideas at how I could accomplish this?
For facebook you can use the opengraph.
Example https://graph.facebook.com/cocacola
You can then extract all the info from the json object.

Finding what it redirects to

I'm using the "Snoopy" class to pick up HTML for phrasing.
The problem is that with one of the pages I need to get the html for redirects automatically because I'm using a the sites search and if it find a perfect result it will redirect.
Here is my snoop:
if($snoopy->fetch("http://www.rottentomatoes.com/search/?search=$pagelink&sitesearch=rt")){
$printable = $snoopy->results;
If the search is exact it will place me on a page like this...
http://www.rottentomatoes.com/m/captain-america/
I need this above link.
Any help would be great,
Thanks!
From poking around in the code a little, it seems like you should be able to check the variable $snoopy->lastredirectaddr, which should be set if you got redirected (if not, it should be a blank string).

Whats up with this google url?

So I know a little bit of PHP, and while I was making custom search links I realized that today google's url after searching something like "hi" isnt just
http://www.google.com/search?q=hi
instead its this
http://www.google.com/#sclient=psy&hl=en&site=&source=hp&q=hi&pbx=1&oq=hi&aq=f&aqi=g5&aql=&gs_sm=e&gs_upl=1705l1911l0l2131l2l2l0l0l0l0l173l299l0.2l2l0&bav=on.2,or.r_gc.r_pw.r_cp.&fp=6c03fc000f912511&biw=1366&bih=681
Just wondering if someone has some insight as to what kind of info the rest of the url is passing along
Some examples of the data passed along:
hl=en #Locale: english
source=hp #Source: homepage
q=hi #Query: hi
In general, it's just whatever extra data that Google wishes to capture or pass along. As you've probably noticed, it's not required data in the sense that http://www.google.com/search?q=query works fine.
The 2nd one is likely an addressing string. This is often used for navigating without full page loads. This way a user can press the back button without going back to a previous url.
If you notice, outside of all the parameters passed, the real difference is:
www.google.com/#
vs:
www.google.com/search?all_the_name=values&
The first example there is no page defined, the pound symbol tells it to stay where it is. Google has a feature that loads the results as you type (not the auto suggest) but the entire page. I can't seem to find how to trigger this though.

Categories