"PHP" / Говнокод #27531 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
do {           
            $entries = $xpath->query("//div[@class='identity']/img");
            if(isset($entries[0])) break;
            $entries = $xpath->query("//h1[@class='avatared']/a/img");
            if(isset($entries[0])) break;
            $entries = $xpath->query("//div[@class='avatared']/a/img");
            if(isset($entries[0])) break;
            $entries = $xpath->query("//div[@itemtype='http://schema.org/Person']/a/img");
        } while(false);
        if(!isset($entries[0])) continue;

        $src = $entries[0]->getAttribute('src');
        if(!preg_match('#[/=]([0-9a-f]{32})[\?&]#', $src, $matches)) continue;
        $hash = $matches[1];

// спустя несколько строк

        do {           
            $entries = $xpath->query("//div[@class='email']/script");
            if(isset($entries[0])) break;
            $entries = $xpath->query("//dl/dd[@class='email']/script");
        } while(false);
        if(isset($entries[0])) {
            $rawcode = $entries[0]->textContent;
            if(!preg_match("#eval\(decodeURIComponent\('(.*)'\)\)#", $rawcode, $matches)) continue;
            $rawcode2 = urldecode($matches[1]);
            if(!preg_match('#href=\\\\?"mailto:([^"\\\\]*)\\\\?"#', $rawcode2, $matches)) continue;
            $email = $matches[1];
            unset($entries);
        } else do {
            $entries = $xpath->query("//div[@class='avatared']/div[@class='details']/dl/dd/a[@data-email]");
            if(isset($entries[0])) break;
            $entries = $xpath->query("//ul[@class='vcard-details']/li[@class='vcard-detail']/a[@data-email]");
        } while(false);
        if(isset($entries[0])) {
            $email = urldecode($entries[0]->getAttribute('data-email'));
        }

Прототип программы, вытягивающей хэш аватарки и е-мейл из архивной копии профиля в «Гитхабе».

Запостил: Nyancat Nyancat, (Updated )

Комментарии (5) RSS

Добавить комментарий для LinuxGovno Отменить ответ

Из-за тебя ушел bormand, guest!

    А не использовать ли нам bbcode?


    8