I'm creating a list with channel IPTV (Brazilian channels) for i use in my house.
I'm tryng to get a stream of an channel from url Using URLHelper, but not success.
URL With Stream
Before using URLHelper to get stream:
rtmp://31.204.151.253/live?wmsAuthSign=c2VydmVyX3RpbWU9MS8xMi8yMDE3IDY6MDc6MTUgUE0maGFzaF92YWx1ZT1Kd1YrL3g5elRML0FtSUVsek1TRk1RPT0mdmFsaWRtaW51dGVzPTIw<playpath>master77_1 <swfUrl>http://www.tv-msn.com/player/player.swf <pageUrl>http://tv-msn.com/TNT.php
Now, before editions to write in M3u List
rtmp://31.204.151.253/live/ playpath=master77_1 swfUrl=http://www.tv-msn.com/player/player.swf pageUrl=http://tv-msn.com/TNT.php - Not worket
And before, i writed a token (is in sfwUrl)
rtmp://31.204.151.253/live/ playpath=master77_1 swfUrl=http://www.tv-msn.com/player/player.swf pageUrl=http://tv-msn.com/TNT.php token=estoudevolta
And the stream URL aren't working, but in URL with stream working.
How to put to work??
Related
For example http://www.dailymotion.com/video/x61t5f7
HLS video url for video id "x61t5f7" :
http://proxy-079.dc3.dailymotion.com/sec(f4590cdd8be1b6d27cdbb3816c862f1b)/video/327/638/365836723_mp4_h264_aac.m3u8
How to extract this stream_hls_url? Any sample program is there it will be helpful.
The code which we tried is as below,
https://api.dailymotion.com/video/x6bdwlu?fields=id,title,stream_hls_url
We are getting error response as below,
we are getting error response like below, {"error":{"more_info":"https://developer.dailymotion.com/api#error-codes","code":403,"message":"Insufficient rights for the fields' parameter of route GET /video/' with value `stream_hls_url'. Required roles: can-read-video-streams, can-read-my-video-streams","type":"access_forbidden"}}
You should try this api
https://www.dailymotion.com/player/metadata/video/<VIDEO_ID>?embedder=
There is a "qualities" object which have a url, get a .m3u8 file from this url. This file contain all HLS Video urls of different qualities.
I'm trying to figure out the best way to get a channel's upload playlistID given the channel's channelID. E.g. for the channel with channelID
UC9CuvdOVfMPvKCiwdGKL3cQ
The corresponding upload playlistID is
UU9CuvdOVfMPvKCiwdGKL3cQ
Notice the second character has changed from a "C" to a "U"
I can do this transformation via string manipulation, but I'm curious if there's a better, less hacky way to find the upload playlist ID through the official youtube api.
Here's some Kotlin code that shows my issue:
I can find the ChannelID for the "Game Grumps" channel through the following youtube api v3 search:
val req = youtube.search().list("snippet");
req.key = {API_KEY}
req.q = "Game Grumps"
req.type = "channel"
val response = req.execute();
The resulting Channel id (response.items[0].snippet.channelId) is UC9CuvdOVfMPvKCiwdGKL3cQ
But when I run the following to try to get the videos uploaded by the channel, I have to use the transformed ChannelID (starting with UU instead of UC)
val req = youtube.PlaylistItems().list("snippet")
req.playlistId = "UU9CuvdOVfMPvKCiwdGKL3cQ"
req.key = {API_KEY}
val response = req .execute()
If I use the untransformed "UC" channelID, I get the following error: The playlist identified with the requests playlistId parameter cannot be found.
Instead of just replacing the second character with a "U", what's the more robust way (e.g. using the youtube API) of translating a ChannelID to a PlaylistID (for the uploads from that channel)?
I would suggest using the official Youtube API, instead of trying to manipulate the strings. You can follow the instructions here:
Instructions to get video ids for all uploaded videos for a channel in V3
Get the channel id for the channel you want (you probably only need to do this once, then you can save it)
Use search.list
Set type to channel
Set q to the name of the channel you want
Grab the channel id (something like this: "channelId": "UC0X2VuXXXXXXXXXXXXXXXX")
Get the playlist id for the channel uploads using the channel id from step 1 (you probably only need to do this once, then you can save it)
Use channels.list
Set id to UC0X2VuXXXXXXXXXXXXXXXX from step 1
Grab the uploads key from contentDetails (something like this: "uploads": "UU0XXXXXXXXXXXXXXXXXXXX")
Get the videos via the playlistitems in the playlist using the playlist id from step 2
Use playlistItems.list
Set playlistId to UU0XXXXXXXXXXXXXXXXXXXX from step 2
Go through each PlaylistItem and pull out the video id
Few video Ids are prefixed with '-' sign. When we search these Id's with prefix on Youtube, it says no records found. However, Youtube is able to play these videos.
Eg:
https://www.youtube.com/watch?v=-xYmfZ2Ic_M (Video will play)
https://www.youtube.com/results?search_query=-xYmfZ2Ic_M (No results
found).
I would like to know: what all characters could come as prefix so that I can allow or remove them before my Youtube API call? Or is there any standard way to handle this thing?
You refer to 'API call' using the URL is not making a API call, its calling the search URL. The URL unfortunatly does not work using a URL encoded parameter.
I suggest to implement this using YouTube API V3. In PHP this correctly retrives the video based on a ID even if it starts with hyphens. I have provided a PHP snippet below...
//In PHP
function videosListById($service, $part, $params) {
$params = array_filter($params);
$response = $service->videos->listVideos(
$part,
$params
);
print_r($response);
}
videosListById($service,
'snippet,contentDetails,statistics',
array('id' => '-xYmfZ2Ic_M'));
To see this in action you can visit the following URL;
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?id=-xYmfZ2Ic_M&part=snippet%2CcontentDetails%2Cstatistics
I'm taking a youtube url as user input.
The logic I have is as follows:
if(URL === link_to_video) then get video
else if( URL == link_to_channel) then get all_videos_of_channel.
I am doing this via JavaScript and using the YouTube API v3.
The problem is, it seems youtube has two types of URLs to youtube channels.
/channel/, eg:
www.youtube.com/channel/UCaHNFIob5Ixv74f5on3lvIw
/user/,
eg: www.youtube.com/user/CalvinHarrisVEVO
both the above links will take you to the same channel, but my current uploader code supports only /user/CalvinHarrisVEVO.
is there any way to make both the URLs behave similarly in terms of obtaining the channel videos?
One solution would be to parse the url and then apply this logic:
if there is `channel` in the url link
call the APIv3 with the **id** of the channel
Ressource : youtube.channels.list
else if there is 'user'
call the APIv3 with the **forUsername** of the channel
Ressource : youtube.channels.list
Check : https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list
After scouring the v3 API documentation (and using the API explorer), I am not able to determine how to obtain the URI of a newly uploaded video resource (or any video resource).
I am aware that the video's ID is readily available and it is trivial to construct a URI from the ID. For example, I have this extension method:
public static Uri GetUri(this Video video)
{
var uriBuilder = new UriBuilder
{
Scheme = Uri.UriSchemeHttp,
Host = "youtu.be",
Path = video.Id,
};
return uriBuilder.Uri;
}
However, it seems strange that the video resource would not include a few different URLs (regular, shortened and embed-able come to mind).
I also recognize I am probably over thinking this because the only volatile part of the URL is the video ID. I guess I could always put the host name in a config file :)
Thoughts and comments are appreciated.
Regards,
You can get the video ID from the upload response once your request is executed.
YouTube API samples have a great upload example for this.
Once you have the video id, you can construct the full URL as
youtube.com/watch?v={video_id}
youtu.be/{video_id}