the only slightly helpful thing I could find regarding LiveLeak API was this Question on Stackexchange: CURL: grabbing liveleak video
If I only have got the Video URL (e.g. http://www.liveleak.com/view?i=numbered_videoid), is there a way to get video meta data without pulling the whole page? xml or json ideally?
Thanks!
LiveLeak's 'API' is at best their RSS Feeds.
The best I could do was to download the 'internal' page for a certain videoid by appending &ajax=1 to the url:
http://mobile.liveleak.com/view?i=100_1338007444&ajax=1
This saved 10.06 KB of bandwidth (about 32%).
Related
I'm trying to create a vCard containing the text below:
BEGIN:VCARD
VERSION:3.0
PHOTO;VALUE=uri:https://upload.wikimedia.org/wikipedia/commons/2/25/Intel_logo_%282006-2020%29.jpg
N:Raven;Test;;;
END:VCARD
according to this documentation (
screenshot of the part I'm talking about ) I tried base64 and it's working fine ( Contact app loads the image ) but in the URI situation it's not working ( Contact app does not load the image ),
To avoid making a large file, my goal is to have a url in my vCard.vcf file not a base64, I'm stuck understanding what's wrong with my vCard.
basically what I'm trying to make is a vCard containing a photo that gets fetched by the url given and shows the photo in contact app of whatever OS the user will open it on (Windows/Android/IOS/macOS).
I'm not using base64 because it makes my vCard file so big.
External urls are probably blocked by most programs, same as loading external images are blocked. It's a massive privacy concern.
Maybe hosting it on a service like Google Cloud would help, in that you can edit the CONTENT-TYPE and CACHE meta data attributes? It’s my novice understanding that smartphone OS is particularly wary of “unknown” file properties - probably for good reason.
I am wondering if there is a way with Objective-C to download a mp4 video that is setup to stream in a Smooth Streaming format. So far I have tried AFNetworking, NSInputStream, and MPMoviePlayerController to try and access the raw video data, but have come up empty in each try.
I would like to then take this video data and save it as a mp4 to disk to be played offline. The URL looks something like this:
http://myurl.com/videoname.ism/manifest(format=m3u8-aapl)
I am going to assume that you are asking about an HTTP Live Streaming video, as indicated by your example URL, instead of a Smooth Streaming video. If this is not the case, please leave a comment and I will edit the answer to speak of Smooth Streaming.
Structure of an HTTP Live Streaming video
There are multiple versions of HTTP Live Streaming (HLS), the newer of which have added proper support for multilanguage audio and captions, which complicates the scenario significantly. I will assume that you do not have interest in such features and will focus on the simple case.
HLS has a three-layer structure:
At the root, you have the Master Playlist. This is what the web server provides when you request the video root URL. It contains references to one or more Media Playlists.
A Media Playlist represents the entire video for one particular configuration. For example, if the media is encoded using two quality levels (such as 720p and 1080p), there will be two Media Playlists, one for each. A Media Playlist contains a list of references to the media segments that actually contain the media data.
The media segments are MPEG Transport Streams which contain a piece of the data streams, generally around 10 seconds per file.
When multilanguage features are out of the picture, it is valid to think of an HLS video as multiple separate videos separated into 10 second chunks - all videos containing the same content but using a different quality level.
Each of the above entities - Master Playlist, Media Playlist, each media segment - is downloaded separately by a player using standard HTTP file download mechanisms.
Putting the pieces back together
All the information a media player requires is present in the media segments - you can mostly ignore the Master Playlist and Media Playlist as their only purpose is to give you the URLs to the media segments.
Thankfully, the MPEG Transport Stream format is very simple in nature. All you need to do in order to put the media segments back together is to concatenate them together. That's it, really!
Pseudocode
I am going to assume that you are not asking about how to perform HTTP requests using Objective-C, as there are many other answers on Stack Overflow on that topic. Instead, I will focus on the algorithm you need to implement.
First, you simply need to download the Master Playlist.
masterPlaylist = download(rootUrl);
The Master Playlist contains both comment lines and data lines. Each data line is a reference to a Media Playlist. Note that the lowest quality level for HLS will generally only have the audio stream. Let's assume here you care about whatever the first quality level in the file is, for simplicity's sake.
masterPlaylistLines = masterPlaylist.split('\n');
masterPlaylistDataLines = filter(masterPlaylistLines, x => !x.startsWith("#"));
firstMasterPlaylistDataLine = masterPlaylistDataLines[0];
This data line will contain the relative URL to the Media Playlist. Let's download it. The URL appending code should be smart and understand how to make relative URLs, not simply a string concatenation.
mediaPlaylist = download(rootUrl + firstMasterPlaylistDataLine);
The Media Playlist, in turn, is formatted the same but contains references to media segments. Let's download them all and append them together.
mediaPlaylistLines = mediaPlaylist.split('\n');
mediaPlaylistDataLines = filter(mediaPlaylistLines, x => !x.startsWith("#"));
foreach (dataLine : mediaPlaylistDataLines)
{
// URL concatenation code is assumed to be smart, not just string concatenation.
mediaSegment = download(rootUrl + firstMasterPlaylistDataLine + dataLine);
appendToFile("Output.ts", mediaSegment);
}
The final output will be a single MPEG Transport Stream file, playable on most modern media players. You can use various free tools such as FFmpeg if you wish to convert it to another format.
When you right click on the video and say "show video info", there is popup that shows fps, frames dropped etc in real time with a timestamp.
I tried to look in the API documentation but couldn't find how this data could be retrieved.
I would like to store this realtime video info data in a file and do post analysis based on time to understand video streaming quality.
Thanks in advance.
You're going to have to use the new v3 API. You can sign up for a YouTube key here: https://console.developers.google.com/apis/api/youtube.googleapis.com
Documentation: https://developers.google.com/youtube/v3/docs/videos/list
To get the actual video info you can then use this URL:
https://www.googleapis.com/youtube/v3/videos?id={VIDEO_ID}&part=snippet%2CcontentDetails%2Cstatistics &key={YOUR_API_KEY}
Note that this answer no longer works. See Dex's answer below.
All the data an app can see about a video is parsed in XML (or JSON if you prefer) using this URL:
XML: http://gdata.youtube.com/feeds/api/videos/###########?v=2
JSON: http://gdata.youtube.com/feeds/api/videos/###########?v=2&alt=json-in-script
Just replace ########## with the ?v= numbers of your video. For instance: http://gdata.youtube.com/feeds/api/videos/rznYifPHxDg?v=2
Here is the original URL to get the xml awnser:
http://gdata.youtube.com/feeds/api/users/RIPPERvideos/uploads
I would like to get all the videos uploaded by this specific user (not be limitted to 20). Also I would like the data to be sorted.
I tried these params:
http://gdata.youtube.com/feeds/api/users/RIPPERvideos/uploads?orderby?v=viewCount
It only seems to be working for these kind of request:
gdata.youtube.com/feeds/api/videos?
q=football+-soccer
&orderby=published
&start-index=11
&max-results=10
&v=2
Can someone help or guide me?
thanks
The URL structure isn't correct, try this (which works):
http://gdata.youtube.com/feeds/api/users/RIPPERvideos/uploads?orderby=viewCount
I'm look at a way of turning an iTunes podcast id into the RSS feed that the podcast producer serves.
I'm aware of the RSS generator, which can be used to generate a feed of links to podcasts, but these links are to HTML pages.
If you have iTunes open, you can manually export the list of podcasts by exporting to OPML, so we can surmise that iTunes eventually knows how to decode them (i.e. they're not exclusively going through an iTMS host).
I have looked at the Affiliate API document which gives you some nice JSON back. This gives you a collectionViewUrl which is the same as the ones given in the RSS generator, and incidentally, the iTunes Link Generator. It also give you the id, and a whole load of other things including a preview audio file which is not hosted on the phobos.
At this point, I'm looking for anything that would help me solve this question, including any language, unofficial or not.
(in actual fact, I'd prefer something vaguely supported, and in Java, that didn't involve HTML scraping).
Through a combination of answers from these two questions, I have found a way to do what I want.
Example of finding podcasts
First: grab a list of podcasts from iTunes, using the RSS generator. I'm not sure how the query parameters work yet, but here is an RSS feed for top tech podcasts in the US.
http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/toppodcasts/sf=143441/limit=25/genre=1318/xml
sf relates to country, and is optional. I would guess that this defaults to global if absent.
genre relates to genre, and is optional. I would guess that this defaults to "all genres" is absent.
limit is optional, and seems to default to 9.
This gives you an Atom feed of podcasts. You'll need to do some sperlunking with XPath to get to the ITMS id of podcast, but you're looking for the numeric id contained in the URL found at the following XPath:
/atom:feed/atom:entry/atom:link[#rel='alernate']/#href
For example, the excellent JavaPosse has an id of 81157308.
The Answer to the Question
Once you have that id, you can get another document which will tell you the last episode, and the original feed URL. The catch here is that you need to use an iTunes user-agent to get this document.
e.g.
wget --user-agent iTunes/7.4.1 \
--no-check-certificate \
"https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/com.apple.jingle.app.finance.DirectAction/subscribePodcast?id=81157308&wasWarnedAboutPodcasts=true"
This is a plist containing some metadata about the podcast, including the feed URL.
<key>feedURL</key><string>http://feeds.feedburner.com/javaposse</string>
The XPath for this could be something like:
//key[#text='feedURL']/following-sibling::string/text()
Disclaimer
Not entirely sure how stable any of this is, or how legal it is. YMMV.
As soon as you have the id you can use it in lookup as defined in
https://performance-partners.apple.com/search-api
You should get what you need by parsing the response with JSON
To elaborate on #juhariis' answer, here's the basics of extracting the feed url from the json (python3):
from urllib.request import urlopen
from urllib.parse import urlparse
import codecs
import json
podcast_url = 'https://itunes.apple.com/us/podcast/grow-big-always/id1060318873'
ITUNES_URL = 'https://itunes.apple.com/lookup?id='
parsed = urlparse(podcast_url)
id = parsed.path.split('/')[-1][2:]
reader = codecs.getreader('utf-8')
with urlopen(ITUNES_URL + id) as response:
feed = json.load(reader(response))['results'][0]['feedUrl']
print(feed)
Here's a script/module I made, that makes use of this: https://gist.github.com/theychx/f9fad123bef27bebac665847c7884cd9
I searched for a long time to deconstruct the iTunes podcast feed. It's a plist containing meta data, of which one of them is an RSS feed. My blog post How to subscribe to iTunes podcasts on Android has links to code in php and in javascript to extract the URL to the RSS feed from an individual iTunes link.