~ubuntu-branches/ubuntu/saucy/libquvi/saucy-proposed

« back to all changes in this revision

Viewing changes to share/lua/website/youjizz.lua

  • Committer: Bazaar Package Importer
  • Author(s): Alejandro Garrido Mota
  • Date: 2011-04-25 01:07:41 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110425010741-nalzd12y180qs082
Tags: 0.2.15-1
* New upstream release (Closes: #622253). 
* Update d/watch to sf.net
* Update homepage field to quvi.sourceforge.net (Closes: #615554) 
* d/rules: Add dh_auto_test before NO_INTERNET=1 in override_dh_auto_test 
* Update Standards-Version field to 3.9.2 
* Add symbol (d/libquvi0.symbols) file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
--
22
22
 
23
23
-- Identify the script.
24
 
function ident (page_url)
25
 
    local t   = {}
26
 
    t.domain  = "youjizz.com"
27
 
    t.formats = "default"
28
 
    t.handles = (page_url ~= nil and page_url:find(t.domain) ~= nil)
29
 
    return t
 
24
function ident (self)
 
25
    package.path = self.script_dir .. '/?.lua'
 
26
    local C      = require 'quvi/const'
 
27
    local r      = {}
 
28
    r.domain     = "youjizz.com"
 
29
    r.formats    = "default"
 
30
    r.categories = C.proto_http
 
31
    local U      = require 'quvi/util'
 
32
    r.handles    = U.handles(self.page_url,
 
33
                    {r.domain}, {"/videos/.-%.html"})
 
34
    return r
30
35
end
31
36
 
32
37
-- Parse video URL.
33
 
function parse (video)
34
 
    video.host_id = "youjizz"
35
 
    local page    = quvi.fetch(video.page_url)
 
38
function parse (self)
 
39
    self.host_id = "youjizz"
 
40
    local page   = quvi.fetch(self.page_url)
36
41
 
37
42
    local _,_,s = page:find("<title>(.-)</")
38
 
    video.title = s or error ("no match: video title")
 
43
    self.title  = s or error ("no match: video title")
39
44
 
40
45
    local _,_,s = page:find("%?id=(%d+)")
41
 
    video.id    = s or error ("no match: video id")
 
46
    self.id     = s or error ("no match: video id")
42
47
 
43
48
    local _,_,s = page:find('addVariable%("file","(.-)"')
44
 
    video.url   = {s or error ("no match: file")}
 
49
    self.url    = {s or error ("no match: file")}
45
50
 
46
 
    return video
 
51
    return self
47
52
end
48
53
 
49
 
 
 
54
-- vim: set ts=4 sw=4 tw=72 expandtab: