From 7572c47d9d2e4ea99abb8b7ba5b3e7a2ad6e92e6 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Thu, 25 Aug 2011 23:06:52 +0300 Subject: [PATCH] Add totallynsfw.lua * Thanks to anon for the contrib * Add share/Makefile.am entry --- share/Makefile.am | 3 +- share/lua/website/totallynsfw.lua | 63 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 share/lua/website/totallynsfw.lua diff --git a/share/Makefile.am b/share/Makefile.am index 73211d9..acb3e71 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -57,7 +57,8 @@ lua/website/xhamster.lua \ lua/website/xvideos.lua \ lua/website/youjizz.lua \ lua/website/pornhub.lua \ -lua/website/spankwire.lua +lua/website/spankwire.lua \ +lua/website/totallynsfw.lua endif if ENABLE_TODO diff --git a/share/lua/website/totallynsfw.lua b/share/lua/website/totallynsfw.lua new file mode 100644 index 0000000..0aa582a --- /dev/null +++ b/share/lua/website/totallynsfw.lua @@ -0,0 +1,63 @@ + +-- quvi +-- Copyright (C) 2011 quvi project +-- +-- This file is part of quvi . +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +-- 02110-1301 USA +-- + +-- Identify the script. +function ident (self) + package.path = self.script_dir .. '/?.lua' + local C = require 'quvi/const' + local r = {} + r.domain = "totallynsfw.com" + r.formats = "default" + r.categories = C.proto_http + local U = require 'quvi/util' + r.handles = U.handles(self.page_url, {r.domain}, {"/videos/.-"}) + return r +end + +-- Query available formats. +function query_formats(self) + self.formats = 'default' + return self +end + +-- Parse media URL. +function parse (self) + self.host_id = "totallynsfw" + local page = quvi.fetch(self.page_url) + + local _,_,s = page:find('"config","(.-)"') + local config_url = s or error ("no match: media config") + + local config_page = quvi.fetch(config_url, {fetch_type='config'}) + local _,_,s = config_page:find('(.-)') + self.url = {s or error ("no match: media url")} + + local _,_,s = page:find('

(.-)

') + self.title = s or error ("no match: media title") + + local _,_,s = config_url:find("config_jwplayer_test/(.-)/") + self.id = s or error ("no match: media id") + + return self +end + +-- vim: set ts=4 sw=4 tw=72 expandtab: -- 2.11.4.GIT