[mythtv-users] tv_grab_au: ninemsn obfuscating data

Phill Edwards philledwards at gmail.com
Wed Nov 9 08:01:04 EST 2005


> I got the latest version from immir's site, which seems to be 1.39
> according to the header, and tried to apply Michael's patch but got...
>
> [root at myth tv_grab_au]# patch tv_grab_au < tv_grab_au.immir.patch
> (Stripping trailing CRs from patch.)
> patching file tv_grab_au
> Hunk #1 FAILED at 218.
> Hunk #2 FAILED at 258.
> Hunk #3 FAILED at 414.
> Hunk #4 FAILED at 605.
> Hunk #5 FAILED at 720.
> 5 out of 5 hunks FAILED -- saving rejects to file tv_grab_au.rej
> [root at myth tv_grab_au]#
>
> Is it possible for someone to provide a copy of the patched script to
> me (directly if nothing else)?
>
> Also, what config needs to be done for this script?  What is the
> default name of the file that provides all the config?

Same problem for me too, except I'm using version $Id: tv_grab_au,v
1.40 2005/08/20 02:09:24 michael Exp $

I've never applied a patch to anything in my life so I haven't the
faintest what the issue is. I'm sure I'm doing it wrong but Itried to
do what it said above - copied the lines in the patch to a file and
then ran this command:

$ patch tv_grab_au_v1.40 < tv_grab.patch

and got thejse errors:

patching file tv_grab_au_v1.40
Hunk #1 FAILED at 218.
Hunk #2 FAILED at 258.
Hunk #3 FAILED at 414.
Hunk #4 FAILED at 605.
Hunk #5 FAILED at 720.
5 out of 5 hunks FAILED -- saving rejects to file tv_grab_au_v1.40.rej

Can someone either please tell me how to apply this patch or post a
file that is already patched.

My patch file is as follows:

*** tv_grab_au  Sat Aug 20 12:09:38 2005
--- tv_grab_au.new      Wed Nov  9 12:08:01 2005
***************
*** 218,223 ****
--- 218,224 ----
   for my $service (@{$conf->{services}}) {

     my $guidedata = get_guide_page($service, dmY($date6am)) or next;
+
     my $tree      = HTML::TreeBuilder->new_from_content($guidedata);

     for ($tree->look_down('_tag' => 'table', 'class' => 'tv')) {
***************
*** 257,262 ****
--- 258,266 ----
         my @link = @{ $e->extract_links() };
         die "too many links:\n" . $html if @link > 1;
         my $url = $NMSN . $link[0]->[0];
+           # NMSN people have some javascript to generate new links, with cu
+           # in them instead of closeup. This should fix that
+           $url =~ s/closeup/cu/;

         # --- check (pid, row, rowspan, title) against old cached data
         my $cache_id = "$date:$pid:$row:$rowspan:$title";
***************
*** 410,415 ****
--- 414,443 ----
   return $want;
 }

+ # --- wrapper for the deobfuscator
+ sub deobfuscate {
+   my ($input) = @_;
+   my $guidedata = $input;
+   # De-obfuscate
+   $guidedata =~ s/jz\('([^']+)'\);/jz($1)/eg;
+   # Also need to remove useless script headers
+   $guidedata =~ s/<SCRIPT src=\"dcr.js\"><\/SCRIPT><SCRIPT
Language=\"Javascript\">/""
/eg;
+   $guidedata =~ s/^<\/SCRIPT><NOSCRIPT>.*<\/NOSCRIPT>/""/eg;
+   return $guidedata;
+ }
+
+ # --- deobfuscator from jollygoodshow at hotmail.com contributed to
+ #     mythuser list
+ sub jz {
+        my ($z) = @_;
+        my ($y);
+
+        $z =~ s/%(..)/chr(hex($1))/eg;
+        ($y = $z) =~ s/(.)/chr(ord($1) - 1)/eg;
+        $y =~ s/%(..)/chr(hex($1))/eg;
+        return $y;
+ }
+
 # --- get details from the closeup page for given show
 sub get_closeup_details {

***************
*** 577,582 ****
--- 605,611 ----
       ($page, $base) = with_progress
         ( "getting regionid and channels for service $service->{name}",
           sub { get_content_base("$TVTODAY?channel=$service->{name}") } );
+
       $service->{region} = "Australia";
       ($service->{regionid})
         = $base =~ /_(\d+).asp/ or die "cannot find regionid";
***************
*** 691,696 ****
--- 720,726 ----
   my $url = shift;
   my $page = (get_content_base($url))[0];
   $page and $page =~ s/&nbsp;/ /g;
+   $page = deobfuscate($page);
   return $page;
 }


Thanks,
Phill


More information about the mythtv-users mailing list