1. Список говнокодов пользователя ququnta

    Всего: 2

  2. PHP / Говнокод #28952

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    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
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    <?php echo "<?xml version='1.0' encoding='UTF-8'?>" ;
    $query = $_GET['q'];
    include 'cfg.php';
    $request = $lemnobase."search?part=id,snippet&maxResults=25&type=video&q=".urlencode($query);
    $ch = curl_init();
    curl_setopt(...);
    $ytdata = json_decode(curl_exec($ch), true);
    curl_close($ch);
      function getUsername($chid) {
          include 'cfg.php';
          $request = "https://www.googleapis.com/youtube/v3/channels?key=".$apikey."&part=snippet&id=".$chid;
          $ch = curl_init();
          curl_setopt(...);
          $responsee = json_decode(curl_exec($ch), true);
          curl_close($ch);
          return str_replace('@', '', $responsee["items"][0]["snippet"]["customUrl"]);
        }
    ?>
    <feed>
        <openSearch:totalResults><?php
     echo $ytdata['pageInfo']['totalResults'];
      ?></openSearch:totalResults>
        <openSearch:startIndex>1</openSearch:startIndex>
        <openSearch:itemsPerPage>25</openSearch:itemsPerPage>
    <?php
      for ($i=0;$i<25;$i++){
        
        include 'cfg.php';
        $request = $lemnobase."videos?part=contentDetails,statistics&id=".$ytdata["items"][$i]["id"]["videoId"];
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $request);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $response = json_decode(curl_exec($ch), true);
        curl_close($ch);
        $duration = new DateInterval ($response['items'][0]['contentDetails']['duration']);
        $duration_s = $duration->days * 86400 + $duration->h * 3600 + $duration->i * 60 + $duration->s;
        ?>
            <entry>
                <id><?php echo $shema ?>://<?php echo $insturl?>/feeds/api/videos/<?php echo $ytdata["items"][$i]["id"]["videoId"]?></id>
                <youTubeId id='<?php echo $ytdata["items"][$i]["id"]["videoId"]?>'><?php echo $ytdata["items"][$i]["id"]["videoId"]?></youTubeId>
                <published><?php echo $ytdata["items"][$i]["snippet"]["publishedAt"]?></published>
                <updated><?php echo $ytdata["items"][$i]["snippet"]["publishedAt"]?></updated>
                <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" label="People & Blogs" term="People & Blogs">People & Blogs</category>
                <title type='text'><?php echo $ytdata["items"][$i]["snippet"]["title"]?></title>
                <content type='text'><?php echo $ytdata["items"][$i]["snippet"]["description"]?></content>
                <link rel="http://gdata.youtube.com/schemas/2007#video.related" href="<?php echo $shema ?>://<?php echo $insturl?>/feeds/api/videos/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/related"/>
                <author>
                    <name><?php echo $ytdata["items"][$i]["snippet"]["channelTitle"] ?></name>
                    <uri>http://gdata.youtube.com/feeds/api/users/<?php echo getUsername($ytdata["items"][$i]["snippet"]["channelId"]) ?></uri>
                </author>
                <gd:comments>
                    <gd:feedLink href='<?php echo $shema ?>://<?php echo $insturl?>/feeds/api/videos/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/comments' countHint='530'/>
                </gd:comments>
                <media:group>
                    <media:category label='People & Blogs' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>People & Blogs</media:category>
                    <media:content url='https://yt2009akivec.onrender.com/channel_fh264_getvideo?v=<?php echo $ytdata["items"][$i]["id"]["videoId"]?>' type='video/3gpp' medium='video' expression='full' duration='999' yt:format='3'/>
                    <media:description type='plain'><?php echo $ytdata["items"][$i]["snippet"]["description"]?></media:description>
                    <media:keywords>-</media:keywords>
                    <media:player url='http://www.youtube.com/watch?v=<?php echo $ytdata["items"][$i]["id"]["videoId"]?>'/>
                    <media:thumbnail yt:name='hqdefault' url='http://i.ytimg.com/vi/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/hqdefault.jpg' height='240' width='320' time='00:00:00'/>
                    <media:thumbnail yt:name='poster' url='http://i.ytimg.com/vi/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/0.jpg' height='240' width='320' time='00:00:00'/>
                    <media:thumbnail yt:name='default' url='http://i.ytimg.com/vi/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/0.jpg' height='240' width='320' time='00:00:00'/>
                    <yt:duration seconds='<?php echo $duration_s?>'/>
                    <yt:videoid id='<?php echo $ytdata["items"][$i]["id"]["videoId"]?>'><?php echo $ytdata["items"][$i]["id"]["videoId"]?></yt:videoid>
                    <youTubeId id='<?php echo $ytdata["items"][$i]["id"]["videoId"]?>'><?php echo $ytdata["items"][$i]["id"]["videoId"]?></youTubeId>
                    <media:credit role='uploader' name='<?php echo $ytdata["items"][$i]["snippet"]["channelTitle"] ?>'><?php echo $ytdata["items"][$i]["snippet"]["channelTitle"] ?></media:credit>
                </media:group>
                <gd:rating average='5' max='5' min='1' numRaters='0' rel='http://schemas.google.com/g/2005#overall'/>
                <yt:statistics favoriteCount="0" viewCount="<?php echo $response['items'][0]['statistics']['viewCount'] ?>"/>
                <yt:rating numLikes="<?php echo $response['items'][0]['statistics']['likeCount'] ?>" numDislikes="0"/>
            </entry>
            
        <?php }; ?>
    </feed>

    Попытка спасти апи гугла для ютуба.
    Провалилась, ибо клиент ютуба оказался говном

    ququnta, 16 Июля 2024

    Комментарии (4)
  3. PHP / Говнокод #28933

    +1

    1. 1
    if ($text[2] == 'www.' or $text[2] == 'Www.' or $text[2] == 'wWw.' or $text[2] == 'wwW.' or $text[2] == 'WwW.' or $text[2] == 'WWw.' or $text[2] == 'wWW.' or $text[2] == 'WWW.')

    Можно было так: if(strtolower($text[2]) == 'www.')

    ququnta, 25 Марта 2024

    Комментарии (15)