Package: clive Version: N/A Severity: wishlist Tags: patch Hello, recently I "needed" support for Sevenload (sevenload.com). This resulted in the attached patch which you might want to add to clive.
But before you read the patch I need to add a warning: I haven't coded in Python before so the attached patch might be totally unfit for inclusion. Please feel free to change the patch in any way you see as necessary. A few additional notes: 1. The parser function uses ElementTree 2. The title which is generated automatically is a little bit hosed: German umlauts get removed, but I'm atm not sure if this happens for all pages or only Sevenload. 3. The patch was generated against parser.py in the Debian package (testing/unstable) I hope this helps to integrate Sevenload support into clive. If you find bugs, please tell me about them, I'd like to learn. ;) Kind regards, Kai Wasserbäch -- Kai Wasserbäch (Kai Wasserbaech) E-Mail: [EMAIL PROTECTED] Jabber (debianforum.de): Drizzt URL: http://wiki.debianforum.de/Drizzt_Do%27Urden GnuPG: 0xE1DE59D2 0600 96CE F3C8 E733 E5B6 1587 A309 D76C E1DE 59D2 (http://pgpkeys.pca.dfn.de/pks/lookup?search=0xE1DE59D2&fingerprint=on&hash=on&op=vindex)
--- parse.py.orig 2008-05-21 18:11:49.000000000 +0200
+++ parse.py 2008-05-21 18:28:57.000000000 +0200
@@ -32,6 +32,7 @@
import string
from htmllib import HTMLParser
+from xml.etree.ElementTree import parse
from clive.path import ConfigDir
from clive.error import CliveError, CliveNoMediaError
@@ -50,6 +51,7 @@
('dailymotion.', 'dmotion', self._parse_dmotion),
('guba.com', 'guba', self._parse_guba),
('metacafe.', 'metac', self._parse_metacafe),
+ ('sevenload.com', 'seven', self._parse_sevenload),
]
## Parses a video page data (HTML)
@@ -221,6 +223,25 @@
url = self._parse_from_to(data, 'mediaURL=', '&', skip_from=1)
return (url, vid, low_quality)
+ def _parse_sevenload(self, url, data, low_quality):
+ # A note for reviewers: I haven't coded in Python before, so you'll
+ # find probably a lot that is wrong. This is more of an
+ # proof-of-concept implementation of Sevenload support.
+ #
+ # We need to construct:
+ # http://flash.sevenload.com/player?itemId=[ID from URL]
+ # that will give us an XML-File as a result, which contains the
+ # Video-Location and a lot of other information that we discard atm
+ #
+ try:
+ vid = url.split('/videos/',1)[1].split('-')[0]
+ except IndexError:
+ vid = self._random_vid()
+
+ sevendom =
parse(urllib.urlopen('http://flash.sevenload.com/player?itemId=' + vid))
+ url =
sevendom.getroot().find('playlists/playlist/items/item/videos/video').get('url')
+ return (url, vid, low_quality)
+
def _random_vid(self):
return md5.new(str(time.time())).hexdigest()[:8]
@@ -249,6 +270,7 @@
title = v_info['page_title'].replace('YouTube -', '')
title = title.replace('GUBA -', '')
title = title.replace(' Video - Metacafe', '')
+ title = title.replace('Video "', '').replace('" | sevenload', '')
try:
if v_info['url'].lower().find('dailymotion.') != -1:
title = title.lstrip('Video ').split('-')[0].rstrip()
signature.asc
Description: OpenPGP digital signature

