Update LJDC
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use LWP::Simple;
|
||||
use HTML::Entities;
|
||||
|
||||
sub usage() {
|
||||
print "usage: ./ljdc in_file [out.xml]\n"
|
||||
@@ -66,6 +67,10 @@ while( defined( $address = <IN_FILE> ) ) {
|
||||
$title = $1;
|
||||
}
|
||||
|
||||
if (length($title) == 0 && $line =~ /<meta property="og:title" content="([^"]+)" \/>/) {
|
||||
$title = $1;
|
||||
}
|
||||
|
||||
# IMG
|
||||
if ($line =~ /<p class="c1">.*<img.*src="([^"]+.gif)".*\/><\/p>/) {
|
||||
$img = $1;
|
||||
@@ -79,6 +84,42 @@ while( defined( $address = <IN_FILE> ) ) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
if ($line =~ /<div class="bodytype"> <p class="e"><img .*src="([^"]+.gif)".*>/) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
if ($line =~ /<div class="bodytype"> <p class="e"><img .*src="([^"]+.jpg)".*\/>/) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
if ($line =~ /<p class="e"><img.*src="([^"]+.jpg)">/) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
if ($line =~ /<p class="e"><img.*src="([^"]+.gif)">/) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
if ($line =~ /<\/source><img src="([^"]+\.gif)">/) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
if ($line =~ /<p class="e"><img src="([^"]+.gif)">/) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
if ($line =~ /<p class="c1">.*<img.*src="([^"]+.gif)".*><\/p>/) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
if ($line =~ /<p class="centredimg"><img.*src="([^"]+.gif)".*><\/p>/) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
if ($line =~ /^<p><img.*src="(http:\/\/ljdchost.com\/[^"]+.gif)".*><\/p>$/) {
|
||||
$img = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if (length($title) == 0 || length($img) == 0)
|
||||
@@ -86,9 +127,12 @@ while( defined( $address = <IN_FILE> ) ) {
|
||||
print "Error with $address\n";
|
||||
print "Title not defined\n" if (length($title) == 0);
|
||||
print "IMG not defined\n" if (length($img) == 0);
|
||||
print { STDERR } $contents;
|
||||
exit 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$title = decode_entities($title);
|
||||
print(OUT_FILE " <entry>\n");
|
||||
print(OUT_FILE " <id>$id</id>\n");
|
||||
print(OUT_FILE " <address>$address</address>\n");
|
||||
|
Reference in New Issue
Block a user