Package: vecc
Cleans and updates your video’s embed code.Over time, the embed codes used for videos from various providers have changed
and evolved, to make them more and more compatible with a broader set of
devices.This is where vecc is useful: it detects the video provider and id from a given
embed code, and provides various utilities to clean this code and validate that
the video is still available.InstallEither usepip, which is the easiest way:$ pip install veccEither download the tarball fromhttp://pypi.python.org/pypi/vecc, untar it,
and install it manually:$ python setup.py installUsage$ vecc -h
usage: vecc [-h] [--version] {clean,validate} ...

Video Embed Code Cleaner.

optional arguments:
  -h, --help        show this help message and exit
  -t TIMEOUT, --timeout TIMEOUT
                    timeout for the validation (10 seconds by default)
  --version         show program's version number and exit

sub-commands:
  {clean,validate}
    clean           clean the embed code
    validate        validate that the video is still availableSub-commandsclean: takes a video embed code, and returns the video id, provider, and
new embed code. Takes an optional-v|--validateparameter, to check if
the video is still available.validate: takes a video id and provider, and check if it’s still
available.Return codesThere’s three different return codes possible:1: Timeout while validating (doing aHEADrequest) the video2: Provider not found3: The video is not available anymoreExample$ vecc clean '<object width="480" height="381"><param name="movie" value="http://www.dailymotion.com/swf/k6Lg9UXest3kho5p9X&related=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/k6Lg9UXest3kho5p9X&related=0" type="application/x-shockwave-flash" width="480" height="381" allowFullScreen="true" allowScriptAccess="always"></embed></object>' -v
video id: k6Lg9UXest3kho5p9X
provider: dailymotion
embed code: <iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/k6Lg9UXest3kho5p9X"></iframe>
This video is still validAPIextract: takes a video embed code and a list of streaming video types (i.e. like .flv or .mp4) for direct video urls and return the following values:status:Trueifvecchas extracted video info,Falseelse. Seeerrnoanderrmsgfor extended info about errorvideo_id: extracted video IDprovider: recognized providerclean_code: embeded codereal_link: web browser link to video with playertitle: video title stringdescription: description or text content of the video (string)image: url link to image preview of videoduration: duration of video in formatHH:MM:SScreated_date: when video was published (python date)errno: iferrno> 0: HTTP request error code or specific API error code, iferrno==-1: global connection error, i.e. no connection to provider (no internet connection or provider website down), iferrno==-2: wrong code formaterrmsg: error message related to error code.Code example# import extract from vecc library
from vecc import extract

video_link = 'a video url'
video_infos = extract(video_link, ['mp4', 'flv'])ProvidersVideo providers (Google video, Youtube, Vimeo, Dailymotion, Facebook…) are configured
in thevecc/providers.pyfile.Each provider configuration consists of:name: youtubelink template: string template (that’ll be interpolated withformat) used to
build the cleaned code. This is the link to the embedded video player. Needs
the{video_id}tag.embed template: string template used to build the new embed code. Needs the{video_link}tag.validation template: string template used to build the link used to validate
that the video is still available. This is the link to the video itself (as
seen on the provider’s website). Needs the{video_id}tag.matches: regular expressions used to “match” a video embed code to a video
provider. Must capture the video id.Changelogv1.01:added validation_link option to extractv1.0:lots of bugfixes after testing 20000 different video links, first mature versionv0.16:added created_date infov0.15:added facebook APIv0.14:added streaming providersv0.13:added extract functionv0.12:Fix previous commit that brokevecc.cleanv0.11:added atimeoutparameter for the validationnow uses proper return codes for failuresv0.10:fix print in py2 following porting to py3v0.9:use schema-less urls for the default providersmake travis use toxprovide a wheel packagev0.8:compatible python 2.6 to python 3.3100% test coveragev0.7:dropped allowfullscreenadded autoPlay=1&related=0 on video linksv0.6:video size of the cleaned embed code is now 480x395all embed codes with iframes use the same format with
allowfullscreen=”true”, autoPlay=”1”, related=”0”v0.5:compatibility with python2.6:argparseas a dependencyv0.4:compatibility with python2.6:formatneeds field numbers