Skip to content

Instantly share code, notes, and snippets.

@danzeeeman
Last active December 12, 2015 03:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danzeeeman/4704397 to your computer and use it in GitHub Desktop.
Save danzeeeman/4704397 to your computer and use it in GitHub Desktop.
My notes on Vine

##My Notes on Vine

Vine is an iOS only application that lets you shoot, edit, and upload a short 6 second clip. You can search twitter to find vines using the twitter api:search 'http://search.twitter.com/search.json?q=vine&since_id=MAX_ID' you'll get something like this (but with 15 results):

{
	   "completed_in" : 0.0110,
	   "max_id" : 2.982193446625239e+17,
	   "max_id_str" : "298219344662523904",
	   "next_page" : "?page=2&max_id=298219344662523904&q=vine",
	   "page" : 1,
	   "query" : "vine",
	   "refresh_url" : "?since_id=298219344662523904&q=vine",
	   "results" : [
	      {
	         "created_at" : "Mon, 04 Feb 2013 00:00:07 +0000",
	         "from_user" : "itsnicolenguyen",
	         "from_user_id" : 16814854,
	         "from_user_id_str" : "16814854",
	         "from_user_name" : "Nicole Nguyen",
	         "geo" : null,
	         "id" : 2.982193446625239e+17,
	         "id_str" : "298219344662523904",
	         "iso_language_code" : "en",
	         "metadata" : {
	            "result_type" : "recent"
	         },
	         "profile_image_url" : "http://a0.twimg.com/profile_images/2450361552/so8hzlt6m41s7j3bh2l6_normal.jpeg",
	         "profile_image_url_https" : "https://si0.twimg.com/profile_images/2450361552/so8hzlt6m41s7j3bh2l6_normal.jpeg",
	         "source" : "<a href="http://vine.co">Vine for iOS</a>",
	         "text" : "This snackadium is goin' DOWN. #SnackBowl2013 http://t.co/XG5X1hQS",
	         "to_user" : null,
	         "to_user_id" : 0,
	         "to_user_id_str" : "0",
	         "to_user_name" : null
	      },
	      {
	         "created_at" : "Mon, 04 Feb 2013 00:00:06 +0000",
	         "from_user" : "KidKulit",
	         "from_user_id" : 18258915,
	         "from_user_id_str" : "18258915",
	         "from_user_name" : "chelle",
	         "geo" : null,
	         "id" : 2.982193427079782e+17,
	         "id_str" : "298219342707978241",
	         "iso_language_code" : "en",
	         "metadata" : {
	            "result_type" : "recent"
	         },
	         "profile_image_url" : "http://a0.twimg.com/profile_images/2942427168/d514353317bfbec812f212e52828196e_normal.jpeg",
	         "profile_image_url_https" : "https://si0.twimg.com/profile_images/2942427168/d514353317bfbec812f212e52828196e_normal.jpeg",
	         "source" : "<a href="http://vine.co">Vine for iOS</a>",
	         "text" : "tacos & kitty halftime show! #puppybowl http://t.co/HHZkj5Kr",
	         "to_user" : null,
	         "to_user_id" : 0,
	         "to_user_id_str" : "0",
	         "to_user_name" : null
	      }......
	   ],
	   "results_per_page" : 15,
	   "since_id" : 0,
	   "since_id_str" : "0"
	}

The important parts are: 'text : tacos & kitty halftime show! #puppybowl http://t.co/HHZkj5Kr' specifically the 'http://t.co/HHZkj5Kr' shortened link. If we take that link and expand it using a shortener expander such as 'http://untiny.me/api/1.0/extract/?url=http://t.co/HHZkj5Kr&format=text' Note: you can use format=xml or format=json with this expander service You'll get back 'http://vine.co/v/b12pADwjVAQ' which is the url of the Vine. So how do we find the MP4 file? lets go 'view-source:view-source:https://vine.co/v/b12pADwjVAQ' in chrome:

<!DOCTYPE html>
<title>KidKulit's post on Vine</title>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# vine-app: http://ogp.me/ns/fb/vine-app#">
	<link rel="stylesheet" type="text/css" href="https://d3422saexnbpnl.cloudfront.net/static/style.css?9">
	<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href=""/static/style_ie7.css?011320121402"}}" /><![endif]-->	
	<link href="//vjs.zencdn.net/c/video-js.css" rel="stylesheet">
	<script src="//vjs.zencdn.net/c/video.js"></script>
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

	<meta property="twitter:card" content="player">
	<meta property="twitter:title" content="KidKulit's post on Vine">
	<meta property="twitter:description" content="tacos &amp; kitty halftime show! #puppybowl">

	<meta property="twitter:image" content="https://vines.s3.amazonaws.com/thumbs/F9174A4D-2C4C-4660-9ACF-DDE18ECCC592-197-0000001A7D11AB22_1.0.4.mp4.jpg?versionId=cbNJul_mcuAbAnNjBUpA.2M_H.GaWgJP">
	<meta property="twitter:site" content="@vineapp">
	<meta property="twitter:player:width" content="435">
	<meta property="twitter:player:height" content="435">
	<meta property="twitter:player" content="https://vine.co/v/b12pADwjVAQ/card">
	<meta property="twitter:player:stream" content="https://vines.s3.amazonaws.com/videos/F9174A4D-2C4C-4660-9ACF-DDE18ECCC592-197-0000001A7D11AB22_1.0.4.mp4?versionId=bKlGvhizVuoY4K.EElpSpnXDCdrP_Pjt">
	<meta property="twitter:player:stream:content_type" content="video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;">

The important parts here are:

<meta property="twitter:player:stream" content="https://vines.s3.amazonaws.com/videos/F9174A4D-2C4C-4660-9ACF-DDE18ECCC592-197-0000001A7D11AB22_1.0.4.mp4?versionId=bKlGvhizVuoY4K.EElpSpnXDCdrP_Pjt"> 

Happy scrapping, also note you'll be making a lot of the HTTP requests well actually lets add it up: 1 GET request for the JSON, 1 GET for each Vine to expand the URL, 1 GET to scrape the file-url, and 1 GET to download the video file. So for each Vine returned in the JSON you'll be making 3 GET requests. You should get back 15 or so Vine with your first search so you'll be making about 45 GETS 15 of them to download a MP4 file.

video for an WIP openFrameworks App

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment