vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[ljcom] r11298: LJSUP-10883: Change endpoint to load art...

Committer: vad
LJSUP-10883: Change endpoint to load article's data from Gazeta.ru
U   trunk/bin/worker/partner-site
Modified: trunk/bin/worker/partner-site
===================================================================
--- trunk/bin/worker/partner-site	2011-12-23 14:23:11 UTC (rev 11297)
+++ trunk/bin/worker/partner-site	2011-12-23 15:09:07 UTC (rev 11298)
@@ -36,6 +36,15 @@
     my $entry_url       = $a->{'entry_url'};
     my $external_url    = $a->{'external_url'};
 
+    ## LJSUP-10883: Change endpoint to load article's data from Gazeta.ru
+    ## Hack: 
+    ##      endpoint uri should be load from config
+    if ($external_url =~ /pg\.gazeta\.ru/){
+        ## http://pg.gazeta.ru/dynamic/GAZETA/PG/_id/n2142902/USE_CONTENT2/1 
+        my ($docid) = $external_url =~ m|dynamic/GAZETA/PG/_id/([^/]+)/USE_CONTENT2/|;
+        $external_url = 'http://www.gazeta.ru/utf8/endpoint2.shtml?id=' . $docid;
+    }
+
     my $response = $ua->get($external_url);
     unless ($response->is_success) {
         die "Can't get content from $external_url: " . $response->status_line;
@@ -58,7 +67,7 @@
         title       => $metadata->title || '',
         description => $metadata->description || '',
         image       => $metadata->image || '',
-        url         => $external_url,
+        url         => $metadata->og_url || $external_url,
     );
 
     my $journalu    = $entry->journal;

Tags: ljcom, vad, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments