弁財天

ゴフマン「専門家を信じるのではなく、自分自身で考えて判断せよ」

tweet_mode => 'extended',

Net::Twitter::Liteで過去ログをダウンロード

このツイを「Net::Twitter::Lite::WithAPIv1_1」取得すると最後がリンク付きでちょん切れるw

'text' => "35) Q previously asked anons to examine the timeline of actions carried out by Barack Obama from November 2017 unti\x{2026} https://t.co/NKQ139iRGF"

「t.co/NKQ139iRGF」は「https://twitter.com/i/web/status/1259648143852843008」へのリンクだw

このURLをGETしてもちょん切れた最後の方の文字列は補完されない

APIの応答をDumperしても完全なツイート文字列はみつからないw、ありえねーw

埋め込み(oembed)APIのREST応答で補完するくらいしか思いつかないw

#!/usr/bin/perl

use REST::Client;
use JSON;
use Data::Dumper;

my $client = REST::Client->new();

$url='https://publish.twitter.com/oembed?url=https%3A%2F%2Ftwitter.com%2Fprayingmedic%2Fstatus%2F1259648143852843008';
#$url='https://publish.twitter.com/oembed?url=https%3A%2F%2Ftwitter.com%2Fi%2Fweb%2Fstatus%2F1259648143852843008';

my $headers = {Accept => 'application/json' };

$client->GET($url, $headers);
my $d = decode_json $client->responseContent();
#print Dumper $d;
print $d->{html}."\n";

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">35) Q previously asked anons to examine the timeline of actions carried out by Barack Obama from November 2017 until the present and cross-reference them with President Trump's actions. <a href="https://t.co/7ZiOmuBD5x">pic.twitter.com/7ZiOmuBD5x</a></p>— Praying Medic (@prayingmedic) <a href="https://twitter.com/prayingmedic/status/1259648143852843008?ref_src=twsrc%5Etfw">May 11, 2020</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

さらにコテコテ編集w

my $txt = "";
my @it = split(/\<\/p\>/, $d->{html});
$txt = $it[0];
print "[$txt]\n";
print "\n\n";
$txt =~ s/\<blockquote class=\"twitter-tweet\"><p lang=\".*\" dir=\"ltr\"\>//;
print "[$txt]\n";

【35) Q previously asked anons to examine the timeline of actions carried out by Barack Obama from November 2017 until the present and cross-reference them with President Trump's actions. <a href="https://t.co/7ZiOmuBD5x">pic.twitter.com/7ZiOmuBD5x</a>】

ちょん切れた文字列を補完することには成功したが、添付されたカード画像の情報がないw

しかも"pic.twitter.com/7ZiOmuBD5x"へのリンクになってるw、なにこれ?w

Web表示させるとこんな→pic.twitter.com/7ZiOmuBD5x

<a href="https://t.co/7ZiOmuBD5x">pic.twitter.com/7ZiOmuBD5x</a>

いやいや、さすがにこの実装は間違ってるw

developer.twitter.com→Sample realtime Tweets

"text": "It's easy to express yourself by Retweeting with a comment. What if you could take it a step further and include me… https://t.co/YTqpNZZ8M9",

"extended_tweet": {
"full_text": "It's easy to express yourself by Retweeting with a comment. What if you could take it a step further and include media? Starting today, you can! Retweet with photos, a GIF, or a video to really make your reaction pop. Available on iOS, Android, and https://t.co/AzMLIfU3jB. https://t.co/Oir5Hpkb2F",

extended_tweet項目が応答に追加されない問題w

developer.twitter.com→Tweet updates

リクエスト・パラメータに「tweet_mode=extended」を追加する拡張仕様らすいw

$statuses = $t->user_timeline({ tweet_mode => 'extended', screen_name => $target, include_rts => "true", count => 1, max_id => $max_id });

tweet_mode => 'extended',の設定なし…

'text' => "35) Q previously asked anons to examine the timeline of actions carried out by Barack Obama from November 2017 unti\x{2026} https://t.co/NKQ139iRGF",

tweet_mode => 'extended',を追加…

'full_text' => '35) Q previously asked anons to examine the timeline of actions carried out by Barack Obama from November 2017 until the present and cross-reference them with President Trump\'s actions. https://t.co/7ZiOmuBD5x',



'extended_entities' => {
'media' => [
{
'url' => 'https://t.co/7ZiOmuBD5x',
'media_url_https' => 'https://pbs.twimg.com/media/EXsh8FgUwAAFxqt.jpg',
'display_url' => 'pic.twitter.com/7ZiOmuBD5x',



'entities' => {
'media' => [
'url' => 'https://t.co/7ZiOmuBD5x',
'id_str' => '1259637836933808128',
'expanded_url' => 'https://twitter.com/prayingmedic/status/1259648143852843008/photo/1',
'type' => 'photo',
'display_url' => 'pic.twitter.com/7ZiOmuBD5x',
'media_url_https' => 'https://pbs.twimg.com/media/EXsh8FgUwAAFxqt.jpg',

https://t.co/7ZiOmuBD5x

<img src="https://pbs.twimg.com/media/EXsh8FgUwAAFxqt.jpg" width=500 />
に編集w

    foreach my $m (@{$status->{entities}{media}}) {
        my $tco_url = $m->{url}; #t.co
        my $long_url = $m->{media_url}; #展開後
        $line =~ s/$tco_url/\<br \/\>\<img src=\"$long_url\" width=500 \/\>/; #t.coを置換
    }

@prayingmedicの 3225ツイ r rr

#Qanon のオバマゲート( #ObamaGate )が始まる。大統領選挙介入と影の大統領と影の政府…

投稿されたコメント:

コメント
コメントは無効になっています。