Advertisement
Guest User

2chproxy-bbspink.diff

a guest
Mar 7th, 2017
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.83 KB | None | 0 0
  1. --- 2chproxy.pl.org 2015-12-05 00:53:23.426707913 +0900
  2. +++ 2chproxy.pl 2017-03-08 12:12:25.344173828 +0900
  3. @@ -101,6 +101,7 @@
  4.    #                       1.レス番                        2.目欄           3.名前/ハッシュ                4.1.日付                       4.2.SE1                       4.3.ID     4.4 <0000>                               5.BE1           6.BE2          7.本文
  5.    RESPONSE_REGEX => '<dt>(\d+)\s[^<]*<(?:a href="mailto:([^"]+)"|font[^>]*)><b>(.*?)</b></(?:a|font)>.((?:[^<]+?)(?:\s*<a href="?http[^">]*"?[^>]*>[^<]*</a>)?(?:\s*(?:[^<]+?(?:(?:<\d+>)+[^<]*)?))?)?\s*(?:<a\s[^>]*be\(([^)]*)\)[^>]*>\?([^<]+)</a>)?<dd>([^\n]+)',
  6.    RESPONSE_REGEX2 => '<div class="number">(\d+)[^>]*</div><div class="name"><b>(?:<a href="mailto:([^"]+)">(.*?)</a>|(.*?))</b></div><div class="date">([^<]+)</div>(?:<div class="be\s[^"]+"><a href="http://be.2ch.net/user/(\d+)"[^>]*>\?([^<]+)</a></div>)?<div class="message">(.*?)</div>',
  7. +  RESPONSE_REGEX3 => '<span class="number">(\d+)[^>]*</span><span class="name"><b>(?:<a href="mailto:([^"]+)">(.*?)</a>|(.*?))</b></span><span class="date">([^<]+)</span>(?:<span class="be\s[^"]+"><a href="http://be.2ch.net/user/(\d+)"[^>]*>\?([^<]+)</a></span>)?</dt><dd class="thread_in">(.*?)</dd>',
  8.    #WEBスクレイピングの細かい部分の正規表現は下の方
  9.  };
  10.  
  11. @@ -404,7 +405,14 @@
  12.    elsif ($html =~ m|$PROXY_CONFIG->{TITLE_REGEX}|s) {
  13.      $title  = $1;
  14.      chomp($title);
  15. -    while ($html =~ m@$PROXY_CONFIG->{RESPONSE_REGEX2}@gs) {
  16. +    my $post_reg;
  17. +    if ($html =~ m|<link\shref="http://[^.]+\.bbspink\.com|) {
  18. +      $post_reg = $PROXY_CONFIG->{RESPONSE_REGEX3};
  19. +    }
  20. +    else {
  21. +      $post_reg = $PROXY_CONFIG->{RESPONSE_REGEX2};
  22. +    }
  23. +    while ($html =~ m@$post_reg@gs) {
  24.        my $line;
  25.        my $res_number = $1+0;
  26.        my $email      = $2 // '';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement