How to get youtube download link from this array - php

I have a PHP script that returns the youtube's url_encoded_fmt_stream_map into arrays
this is an example of one of those arrays
Array
(
[quality] => hd720
[itag] => 45
[url] => http://r7---sn-25ge7n7l.c.youtube.com/videoplayback?source=youtube&expire=1377205488&cp=U0hWTFJLU19NUkNONl9KRVdFOlFROHcyQXZRVzMw&sver=3&mt=1377182899&itag=45&id=f3a24c732e4ea990&upn=aBSr1FoD9WM&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&fexp=919112%2C919363%2C914074%2C916624%2C909546%2C906397%2C929117%2C929121%2C929906%2C929907%2C929922%2C929127%2C929129%2C929131%2C929930%2C925720%2C925722%2C925718%2C929917%2C929919%2C929933%2C912521%2C919206%2C932306%2C913428%2C920605%2C904830%2C919373%2C930803%2C908536%2C904122%2C938701%2C911423%2C936308%2C909549%2C900816%2C912711%2C904494%2C904497%2C900375%2C906001&ipbits=8&ratebypass=yes&ip=31.170.160.74&key=yt1&ms=au&mv=u
[fallback_host] => tc.v23.cache8.c.youtube.com
[type] => video/webm; codecs=\"vp8.0, vorbis\"
[sig] => 1A6118D09B20DCD2CD068CAD2415C6BFF80FF5F0.5FB3424173B8FABE7379689138DFA7038B5F11B4
)
how can i put these informations together to make a valid download link ?
any help will be much appreciated and thanks in advance

The download url is already there in the result, for example :
http://r7---sn-25ge7n7l.c.youtube.com/videoplayback?source=youtube&expire=1377205488&cp=U0hWTFJLU19NUkNONl9KRVdFOlFROHcyQXZRVzMw&sver=3&mt=1377182899&itag=45&id=f3a24c732e4ea990&upn=aBSr1FoD9WM&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&fexp=919112%2C919363%2C914074%2C916624%2C909546%2C906397%2C929117%2C929121%2C929906%2C929907%2C929922%2C929127%2C929129%2C929131%2C929930%2C925720%2C925722%2C925718%2C929917%2C929919%2C929933%2C912521%2C919206%2C932306%2C913428%2C920605%2C904830%2C919373%2C930803%2C908536%2C904122%2C938701%2C911423%2C936308%2C909549%2C900816%2C912711%2C904494%2C904497%2C900375%2C906001&ipbits=8&ratebypass=yes&ip=31.170.160.74&key=yt1&ms=au&mv=u
will be the url you are looking for in above. This url will change with every request and also only available from the IP which requested it.

Related

Laravel one way communication

I want laravel backend to send a message to my Ionic App whenever there is an entry in my database. I don't want to do polling at frontend, found this library rukavina/kurento-client-php
(https://github.com/rukavina/kurento-client-php) but unable to get any success as I was getting this error.
Array (
[code] => 40201
[data] => Array (
[type] => SDP_PARSE_ERROR
)
[message] => Empty offer not valid
)
Can anyone help me who either implemented kurento-client-php library or worked on similar situation.
Finally did it using Laravel-ratchet and php-zmq.

Fetch Report using GoodData API

I have created a report on my GoodData UI. Now I want to fetch this report using the API. I spent hours digging the API docs but I am unable to find a simple way to do so.
If I try gdc/execute/raw/, it returns
[error] => Array
(
[parameters] => Array
(
[0] => execute
)
[requestId] => 53fPgKcFdkjf8PZ5:4n6x9lp9vk3ydbvs
[component] => GDC
[errorClass] => GDC::Exception::NotFound
[message] => resource %s not found
)
If I try gdc/xtab2/executor3 it returns
[error] => Array
(
[parameters] => Array
(
[0] => report_req
[1] => STRUCTURE INVALID - name of structure:'ReportReq'(tag:report_req), /report_req/ExecutionObject: Object does not match any alternative. Alternatives tried : [STRUCTURE INVALID - name of structure:'ReportReq' ...]
)
[requestId] => a0yRpNUpCPRsbPS0:6nagmwaw61h5g2bn
[component] => Apache::REST
[errorClass] => GDC::Exception::User
[message] => Checking '%s', result %s
)
Your requests got 404 and 400 statuses respectively.
When you tried to use 'gdc/execute/raw/' the call that reached our side was: "request="POST /gdc/execute/raw/ HTTP/1.1"", instead of that it should look like "POST /gdc/app/projects/{your_project_id}/execute/raw/ HTTP/1.1", that's the reason your are getting a 'NotFound' error. Regarding 'gdc/xtab2/executor3' there's apparently something wrong within the body of the call.
Please post your calls here, their bodies and how exactly you are making them, or open a support ticket with those details at https://support.gooddata.com/home so that we can investigate further.
Ultimately I followed this code piece https://gist.github.com/gnilrets/b9d2ce9890d8aaa07042
Much better than reading the whole GoodData API documentation.

Facebook Graph API: get a Link title/caption/picture/description before posting to FB

I would like to show the automatically generated name, caption, description and picture from a URL before posting it to Facebook in my app.
This way the user can enter a URL and see what the defaults will be. If they wish to change the title/caption/picture/description before posting the link via the Graph API then they can.
Is there a way to do this through the Graph API, or would I need to build my own simple scraper and look for relevant meta tags myself?
Cheers,
Dave
--
Edit: Thanks #CBroe for the answer. Here's a dirty example in PHP for anyone else:
$url = 'http://google.com';
$ch = curl_init('https://graph.facebook.com/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS,array(
'id' => $url,
'scrape' => true,
));
$data = json_decode(curl_exec($ch),true);
print_r($data);
example output
Array
(
[url] => http://www.google.com/
[type] => website
[title] => Google
[image] => Array
(
[0] => Array
(
[url] => http://www.google.com/images/google_favicon_128.png
)
)
[description] => Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
[updated_time] => 2014-04-02T10:41:44+0000
[id] => 381702034999
)
works in app:
See Updating Objects in Facebook’s Open Graph documentation.
You can make a POST call to the API to get any URL scraped, and (on success) it will return you the “all the information about the object that was scraped” in JSON format.

How to retrieve a specific discussion from linkedin group using PHP

How can I retrieve a specific post/discussion from a open group through LinkedIn API using PHP.
I was trying with the following API request as shown in here http://developer.linkedin.com/documents/groups-api#post :
https://api.linkedin.com/v1/posts/5835685921059532803:(id,type,category,creator,title,summary,creation-timestamp,relation-to-viewer:(is-following,is-liked,available-actions),likes,comments,attachment,site-group-post-url)
But this returns the following error:
Array
(
[status_code] => 400
[data] => stdClass Object
(
[errorCode] => 0
[message] => Invalid Post.id String {5835685921059532803}
[requestId] => XW2XMPBNKY
[status] => 400
[timestamp] => 1391441328953
)
)
Now, what's the error I have made with this request? What should I do to get a specific discussion?
Thanks.
I just solved the problem. The problem was while making the request. The discussion id (5835685921059532803) I was sending with URL was in wrong format. It should be like: g-GROUP_ID-S-DISCUSSION/POST_ID, for example: g-24405-S-5835685921059532803.
So the URL should be:
https://api.linkedin.com/v1/posts/g-24405-S-5835685921059532803:(id,type,category,creator,title,summary,creation-timestamp,relation-to-viewer:(is-following,is-liked,available-actions),likes,comments,attachment,site-group-post-url)
Hope this would save someone's valuable time.
You need An Api key and Secret key,to get an AUTHORIZATION_CODE,using that AUTHORIZATION_CODE,you will get an Access Token,and with that Access Token if you hit the url,then you will get the proper data,
details http://developer.linkedin.com/documents/authentication

Getting current song info from online radio/tv

I'd like to get the song or program name details from a particular online radio/tv broadcast url. This url could be a file with *.pls extension or in form of mms protocol.
Is there any web request technic, library for php or any popular language?
i am not so sure that this answer will help you, but it can lead you to solution
$url = parse_url(URL);
abouve url will give you an array of the following format
Array
(
[scheme] => http
[host] => eksensc.radyotvonline.com
[path] => /listen.pls
)
you can get $url['path'] from that array,
Hope it hepls ! Thanks

Categories