Package: clive
Version: N/A
Severity: wishlist
Tags: patch

Hello (again),
I just added support for MyVideo to clive. If you'd like to integrate it into
clive, feel free to apply the attached patch as you see fit.

Again I would appreciate notes on the patch (especially if you change anything).

Kind regards,
Kai Wasserbäch


P.S.: Has anyone already tried to figure out how to get videos from Yahoo!
downloaded? I wasn't able to find the _real_ video URL in the mess that is their
unformatted JavaScript... If someone knows how to construct download URLs for
them (http://video.yahoo.com/) please send me a personal e-mail and I'll try to
add it to clive.



-- 

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-06-11 17:46:10.000000000 +0200
+++ parse.py    2008-06-11 18:11:47.000000000 +0200
@@ -61,6 +61,7 @@
             ('guba.com', 'guba', self._parse_guba),
             ('metacafe.', 'metac', self._parse_metacafe),
             ('sevenload.com', 'sevenl', self._parse_sevenload),
+            ('myvideo.de', 'myvid', self._parse_myvideo),
         ]
 
     ## Parses a video page data (HTML)
@@ -254,6 +255,22 @@
         url = self._parse_from_to(data, 'video url="', '"', skip_from=1)
         return (url, vid, low_quality)
 
+    def _parse_myvideo(self, url, data, low_quality):
+        # There are two input formats for URLs we must consider.
+        # 1. http://www.myvideo.de/watch/[VIDEO-ID]
+        # 2. http://www.myvideo.de/watch/[VIDEO-ID]/[VIDEO-TITLE]
+        # And in the end it doesn't matter really whether we got the ID or not
+        # if we could extract it, the search for the video location could be
+        # more accurate. But then, if they change something, we must probably
+        # change the script anyway.
+        try:
+            vid = url.split('/watch/',1)[1]
+        except IndexError:
+            vid = self._random_vid()
+        url = self._parse_from_to(self._fetch_page(url), 'player_V20p.swf?', 
+                        '&ID=', skip_from=1)
+        return (url, vid, low_quality)
+
     def _fetch_page(self, url):
         g = URLGrabber(user_agent = self._opts.http_agent,
             http_headers = (('accept-encoding', 'gzip'),),
@@ -307,6 +324,12 @@
             title = title.replace('" | sevenload','')
             ext = 'flv'
 
+        if v_info['v_host'] == 'myvid':
+            title = self._parse_from_to(self._fetch_page(v_info['url']),
+                            '<meta name=\'keywords\' content=\'',
+                            ', ',skip_from=1).replace('XXX','')
+            ext = 'flv'
+
         if self._opts.output_mask == 'custom':
             sys.path.append(ConfigDir().dir())
             try:

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to