I took this patch and adapted it for use with the immir 0.40 tv_grab release.

It's not very robust - small changes to ninemsn will break it. I'll send the patch to immir and he can whack up a good one. But for the moment, this seems to get me guide data.

Thanks to jgs for the deobfuscating regexp.

For those that don't know how to use patch. Something like:

   patch /usr/bin/tv_grab_au < tv_grab_au.immir.patch

should work.

Michael

first last wrote:

Haven't seen this mentioned on the list but ninemsn seems to be using
JavaScript to hide data.  The attached patch to the old tv_grab_au does
the trick for me.  Tried upgrading to tv_grab_au from immir but couldn't
be arsed fighting through dependency hell.

-jgs

------------------------------------------------------------------------

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

*** /home/michael/tv_grab_au    Sat Aug 20 12:09:38 2005
--- tv_grab_au  Wed Nov  9 10:29:48 2005
***************
*** 218,223 ****
--- 218,230 ----
    for my $service (@{$conf->{services}}) {
  
      my $guidedata = get_guide_page($service, dmY($date6am)) or next;
+ 
+     # 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;
+     
      my $tree      = HTML::TreeBuilder->new_from_content($guidedata);
  
      for ($tree->look_down('_tag' => 'table', 'class' => 'tv')) {
***************
*** 257,262 ****
--- 264,272 ----
          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 ****
--- 420,437 ----
    return $want;
  }
  
+ # --- 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 {
  
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

Reply via email to