2016-12-14 4 views
1

Я получаю твиты с API Twitter, и я это делаю: Я проверяю, что у них есть quoted_status, затем я заменяю URL-адрес в url_info->url, который имеет tweet_data->quoted_status->id_str в пределах url_info->expanded_url. Таким образом, я знаю, что URL-адрес цитируемого твита, и я могу восстановить данные и отобразить их ниже.Почему этот цитированный твит, указывающий на себя?

И это, как правило, работает, но не с этим твиттере:

stdClass Object 
(
[created_at] => Wed Dec 14 08:30:32 +0000 2016 
[id] => 8.0895229853789E+17 
[id_str] => 808952298537885696 
[text] => Volem felicitar al Centre d'Estudis Montseny, guanyadors d'aquest concurs, i a @stlisieux, que han estat finalistes… 'shortened_url'/CGqkTNPPB1 
[truncated] => 1 
[entities] => stdClass Object 
    (
     [hashtags] => Array 
      (
      ) 

     [symbols] => Array 
      (
      ) 

     [user_mentions] => Array 
      (
       [0] => stdClass Object 
        (
         [screen_name] => stlisieux 
         [name] => Col·legi ST Lisieux 
         [id] => 3064329677 
         [id_str] => 3064329677 
         [indices] => Array 
          (
           [0] => 79 
           [1] => 89 
          ) 

        ) 

      ) 

     [urls] => Array 
      (
       [0] => stdClass Object 
        (
         [url] => 'shortened_url'CGqkTNPPB1 
         [expanded_url] => https://twitter.com/i/web/status/808952298537885696 
         [display_url] => twitter.com/i/web/status/8… 
         [indices] => Array 
          (
           [0] => 117 
           [1] => 140 
          ) 

        ) 

      ) 

    ) 

[source] => Twitter Web Client 
[in_reply_to_status_id] => 
[in_reply_to_status_id_str] => 
[in_reply_to_user_id] => 
[in_reply_to_user_id_str] => 
[in_reply_to_screen_name] => 
[user] => stdClass Object 
    (
     [id] => 493037120 
     [id_str] => 493037120 
     [name] => Clickedu 
     [screen_name] => Clickedu 
     [location] => España 
     [description] => La plataforma para colegios e institutos. | La plataforma per a escoles i instituts. 'shortened_url'/NBZbqw7Qpn 
     [url] => 'shortened_url'/00a8v8WUv5 
     [entities] => stdClass Object 
      (
       [url] => stdClass Object 
        (
         [urls] => Array 
          (
           [0] => stdClass Object 
            (
             [url] => 'shortened_url'/00a8v8WUv5 
             [expanded_url] => http://www.clickartedu.com/ 
             [display_url] => clickartedu.com 
             [indices] => Array 
              (
               [0] => 0 
               [1] => 22 
              ) 

            ) 

          ) 

        ) 

       [description] => stdClass Object 
        (
         [urls] => Array 
          (
           [0] => stdClass Object 
            (
             [url] => 'shortened_url'/NBZbqw7Qpn 
             [expanded_url] => http://www.clickedu.eu 
             [display_url] => clickedu.eu 
             [indices] => Array 
              (
               [0] => 85 
               [1] => 107 
              ) 

            ) 

          ) 

        ) 

      ) 

     [protected] => 
     [followers_count] => 2960 
     [friends_count] => 1998 
     [listed_count] => 79 
     [created_at] => Wed Feb 15 11:29:55 +0000 2012 
     [favourites_count] => 8529 
     [utc_offset] => 3600 
     [time_zone] => Madrid 
     [geo_enabled] => 1 
     [verified] => 
     [statuses_count] => 3840 
     [lang] => ca 
     [contributors_enabled] => 
     [is_translator] => 
     [is_translation_enabled] => 
     [profile_background_color] => AD0C40 
     [profile_background_image_url] => http://pbs.twimg.com/profile_background_images/444501732022697984/vMM1qgYt.jpeg 
     [profile_background_image_url_https] => https://pbs.twimg.com/profile_background_images/444501732022697984/vMM1qgYt.jpeg 
     [profile_background_tile] => 
     [profile_image_url] => http://pbs.twimg.com/profile_images/567973366670172160/1opAPyhE_normal.jpeg 
     [profile_image_url_https] => https://pbs.twimg.com/profile_images/567973366670172160/1opAPyhE_normal.jpeg 
     [profile_banner_url] => https://pbs.twimg.com/profile_banners/493037120/1477042035 
     [profile_link_color] => AD0C40 
     [profile_sidebar_border_color] => FFFFFF 
     [profile_sidebar_fill_color] => DDEEF6 
     [profile_text_color] => 333333 
     [profile_use_background_image] => 1 
     [has_extended_profile] => 
     [default_profile] => 
     [default_profile_image] => 
     [following] => 
     [follow_request_sent] => 
     [notifications] => 
     [translator_type] => none 
    ) 

[geo] => 
[coordinates] => 
[place] => 
[contributors] => 
[is_quote_status] => 1 
[quoted_status_id] => 8.0870805032451E+17 
[quoted_status_id_str] => 808708050324508672 
[quoted_status] => stdClass Object 
    (
     [created_at] => Tue Dec 13 16:19:58 +0000 2016 
     [id] => 8.0870805032451E+17 
     [id_str] => 808708050324508672 
     [text] => Així és com veuen l’ictus els alumnes del Centre d’Estudis Montseny, que han guanyat el 18è concurs Pinta La Marató… 'shortened_url'/tts4uGmKWy 
     [truncated] => 1 
     [entities] => stdClass Object 
      (
       [hashtags] => Array 
        (
        ) 

       [symbols] => Array 
        (
        ) 

       [user_mentions] => Array 
        (
        ) 

       [urls] => Array 
        (
         [0] => stdClass Object 
          (
           [url] => 'shortened_url'/tts4uGmKWy 
           [expanded_url] => https://twitter.com/i/web/status/808708050324508672 
           [display_url] => twitter.com/i/web/status/8… 
           [indices] => Array 
            (
             [0] => 117 
             [1] => 140 
            ) 

          ) 

        ) 

      ) 

     [source] => Twitter Web Client 
     [in_reply_to_status_id] => 
     [in_reply_to_status_id_str] => 
     [in_reply_to_user_id] => 
     [in_reply_to_user_id_str] => 
     [in_reply_to_screen_name] => 
     [user] => stdClass Object 
      (
       [id] => 18045654 
       [id_str] => 18045654 
       [name] => La Marató 
       [screen_name] => la_marato 
       [location] => Catalunya 
       [description] => El 18 de desembre La Marató fa 25 anys amb un programa dedicat a l'ictus i les lesions medul·lars i cerebrals traumà tiques. 
       [url] => 'shortened_url'/iCXlb20x3w 
       [entities] => stdClass Object 
        (
         [url] => stdClass Object 
          (
           [urls] => Array 
            (
             [0] => stdClass Object 
              (
               [url] => 'shortened_url'/iCXlb20x3w 
               [expanded_url] => http://www.tv3.cat/marato/ 
               [display_url] => tv3.cat/marato/ 
               [indices] => Array 
                (
                 [0] => 0 
                 [1] => 22 
                ) 

              ) 

            ) 

          ) 

         [description] => stdClass Object 
          (
           [urls] => Array 
            (
            ) 

          ) 

        ) 

       [protected] => 
       [followers_count] => 46627 
       [friends_count] => 352 
       [listed_count] => 333 
       [created_at] => Thu Dec 11 11:38:21 +0000 2008 
       [favourites_count] => 1469 
       [utc_offset] => 3600 
       [time_zone] => Madrid 
       [geo_enabled] => 
       [verified] => 
       [statuses_count] => 3160 
       [lang] => ca 
       [contributors_enabled] => 
       [is_translator] => 
       [is_translation_enabled] => 
       [profile_background_color] => DCE4E8 
       [profile_background_image_url] => http://pbs.twimg.com/profile_background_images/378800000099697740/e6dc40b2a9233a582dc14394aed732a7.jpeg 
       [profile_background_image_url_https] => https://pbs.twimg.com/profile_background_images/378800000099697740/e6dc40b2a9233a582dc14394aed732a7.jpeg 
       [profile_background_tile] => 
       [profile_image_url] => http://pbs.twimg.com/profile_images/748843776345513985/WXSEA15G_normal.jpg 
       [profile_image_url_https] => https://pbs.twimg.com/profile_images/748843776345513985/WXSEA15G_normal.jpg 
       [profile_banner_url] => https://pbs.twimg.com/profile_banners/18045654/1481702408 
       [profile_link_color] => 0084B4 
       [profile_sidebar_border_color] => FFFFFF 
       [profile_sidebar_fill_color] => DDEEF6 
       [profile_text_color] => 333333 
       [profile_use_background_image] => 1 
       [has_extended_profile] => 
       [default_profile] => 
       [default_profile_image] => 
       [following] => 
       [follow_request_sent] => 
       [notifications] => 
       [translator_type] => none 
      ) 

     [geo] => 
     [coordinates] => 
     [place] => 
     [contributors] => 
     [is_quote_status] => 
     [retweet_count] => 15 
     [favorite_count] => 21 
     [favorited] => 
     [retweeted] => 
     [possibly_sensitive] => 
     [lang] => und 
    ) 

[retweet_count] => 2 
[favorite_count] => 2 
[favorited] => 
[retweeted] => 
[possibly_sensitive] => 
[lang] => und 
) 

Здесь [expanded_url] => https://twitter.com/i/web/status/808952298537885696 указывает на сам твит, не цитируемого чирикать, как обычно.

Это обычное явление? Как связать сокращенный URL-адрес в тексте с цитированным твитом? Я не вижу никакой связи между ними, поэтому я не знаю, как заменить ссылку на содержимое твита, поскольку я не знаю, как отличить цитированный URL-адрес твита с другими URL-адресами, которые могут быть в чириканье.

ответ

1

Поскольку значение truncated в этом Tweet - true (1), это означает, что вы просматриваете расширенный твит. Вы можете узнать больше о новом формате Tweet в документации разработчика Twitter Upcoming Changes to Tweets. Если вы используете опцию tweet_mode=extended, вы сможете получить полную версию Tweet без встроенной ссылки на веб-версию Tweet.

Смежные вопросы