Linqtotwitter的转发没有显示为来自流的转发

本文关键字:转发 Linqtotwitter 显示 | 更新日期: 2023-09-27 18:06:20

我正在使用linqtotwitter (v3.1.2)库将推文流式传输到应用程序中,但我们不想处理转发。当我收到一条转发时,属性retweted和retwetedstatus。ID总是false和0。

这是库中的错误吗?我看了源代码在GitHub和它看起来应该工作。

目前我只是想看看这条推文是否以"RT"开头,但这当然不是100%准确。

Linqtotwitter的转发没有显示为来自流的转发

这似乎是库中的一个错误。我通过检查推文是否以"RT"开头来编码这个问题。虽然不理想,但它可以达到我的目的。

Twitter API将retweeted设置为false,这就是为什么返回的Status实体中的Retweeted属性为false。考虑到这一点,你可以做两件事来跟踪转发:

  1. 你可以像你一样检查以RT开头的推文,因为有些人仍然这样做转发,而不是点击转发按钮。
  2. 查看Status实体的RetweetedStatus属性。如果是转发,这将是一个有效的Status实例。如果不是转发,RetweetedStatus将为空。
就像我说的,Twitter API正在发送false。以下是转发的原始JSON:
{
    "created_at": "Tue Dec 15 17:41:31 +0000 2015",
    "id": 676819388972994560,
    "id_str": "676819388972994560",
    "text": "RT @Dotnetster: Favourites.io built with LinqToTwitter @JoeMayo.  Search and tag your Twitter Favourites. https:'/'/t.co'/CBkJL4KS5Q",
    "source": "'u003ca href='"http:'/'/twitter.com'" rel='"nofollow'"'u003eTwitter Web Client'u003c'/a'u003e",
    "truncated": false,
    "in_reply_to_status_id": null,
    "in_reply_to_status_id_str": null,
    "in_reply_to_user_id": null,
    "in_reply_to_user_id_str": null,
    "in_reply_to_screen_name": null,
    "user": {
        "id": 15411837,
        "id_str": "15411837",
        "name": "Joe Mayo",
        "screen_name": "JoeMayo",
        "location": "Las Vegas, NV",
        "description": "Author, Consultant, and Instructor. Microsoft .NET MVP. #VegasTech",
        "url": "http:'/'/t.co'/8atdOuFAEx",
        "entities": {
            "url": {
                "urls": [{
                    "url": "http:'/'/t.co'/8atdOuFAEx",
                    "expanded_url": "http:'/'/www.mayosoftware.com",
                    "display_url": "mayosoftware.com",
                    "indices": [0, 22]
                }]
            },
            "description": {
                "urls": []
            }
        },
        "protected": false,
        "followers_count": 2578,
        "friends_count": 274,
        "listed_count": 174,
        "created_at": "Sun Jul 13 04:35:50 +0000 2008",
        "favourites_count": 12,
        "utc_offset": -28800,
        "time_zone": "Pacific Time (US & Canada)",
        "geo_enabled": true,
        "verified": false,
        "statuses_count": 2984,
        "lang": "en",
        "contributors_enabled": false,
        "is_translator": false,
        "is_translation_enabled": false,
        "profile_background_color": "FFFFFF",
        "profile_background_image_url": "http:'/'/abs.twimg.com'/images'/themes'/theme19'/bg.gif",
        "profile_background_image_url_https": "https:'/'/abs.twimg.com'/images'/themes'/theme19'/bg.gif",
        "profile_background_tile": false,
        "profile_image_url": "http:'/'/pbs.twimg.com'/profile_images'/456514674377256960'/PiL4qsWR_normal.jpeg",
        "profile_image_url_https": "https:'/'/pbs.twimg.com'/profile_images'/456514674377256960'/PiL4qsWR_normal.jpeg",
        "profile_banner_url": "https:'/'/pbs.twimg.com'/profile_banners'/15411837'/1398199881",
        "profile_link_color": "3B94D9",
        "profile_sidebar_border_color": "FFFFFF",
        "profile_sidebar_fill_color": "F6FFD1",
        "profile_text_color": "333333",
        "profile_use_background_image": false,
        "has_extended_profile": false,
        "default_profile": false,
        "default_profile_image": false,
        "following": true,
        "follow_request_sent": false,
        "notifications": true
    },
    "geo": null,
    "coordinates": null,
    "place": null,
    "contributors": null,
    "retweeted_status": {
        "created_at": "Tue Dec 15 17:34:26 +0000 2015",
        "id": 676817605064290306,
        "id_str": "676817605064290306",
        "text": "Favourites.io built with LinqToTwitter @JoeMayo.  Search and tag your Twitter Favourites. https:'/'/t.co'/CBkJL4KS5Q",
        "source": "'u003ca href='"http:'/'/twitter.com'" rel='"nofollow'"'u003eTwitter Web Client'u003c'/a'u003e",
        "truncated": false,
        "in_reply_to_status_id": null,
        "in_reply_to_status_id_str": null,
        "in_reply_to_user_id": null,
        "in_reply_to_user_id_str": null,
        "in_reply_to_screen_name": null,
        "user": {
            "id": 26903787,
            "id_str": "26903787",
            "name": "Ross McLoughlin",
            "screen_name": "Dotnetster",
            "location": "",
            "description": "Favourites.io",
            "url": "http:'/'/t.co'/acXDZ35G1d",
            "entities": {
                "url": {
                    "urls": [{
                        "url": "http:'/'/t.co'/acXDZ35G1d",
                        "expanded_url": "http:'/'/www.favourites.io",
                        "display_url": "favourites.io",
                        "indices": [0, 22]
                    }]
                },
                "description": {
                    "urls": []
                }
            },
            "protected": false,
            "followers_count": 206,
            "friends_count": 320,
            "listed_count": 52,
            "created_at": "Fri Mar 27 00:41:29 +0000 2009",
            "favourites_count": 1393,
            "utc_offset": 0,
            "time_zone": "Dublin",
            "geo_enabled": false,
            "verified": false,
            "statuses_count": 6662,
            "lang": "en",
            "contributors_enabled": false,
            "is_translator": false,
            "is_translation_enabled": false,
            "profile_background_color": "000000",
            "profile_background_image_url": "http:'/'/pbs.twimg.com'/profile_background_images'/182308454'/twitter.jpg",
            "profile_background_image_url_https": "https:'/'/pbs.twimg.com'/profile_background_images'/182308454'/twitter.jpg",
            "profile_background_tile": false,
            "profile_image_url": "http:'/'/pbs.twimg.com'/profile_images'/459298001505099777'/lQd1OjeL_normal.jpeg",
            "profile_image_url_https": "https:'/'/pbs.twimg.com'/profile_images'/459298001505099777'/lQd1OjeL_normal.jpeg",
            "profile_link_color": "0084B4",
            "profile_sidebar_border_color": "C0DEED",
            "profile_sidebar_fill_color": "DDEEF6",
            "profile_text_color": "333333",
            "profile_use_background_image": false,
            "has_extended_profile": false,
            "default_profile": false,
            "default_profile_image": false,
            "following": false,
            "follow_request_sent": false,
            "notifications": false
        },
        "geo": null,
        "coordinates": null,
        "place": null,
        "contributors": null,
        "is_quote_status": false,
        "retweet_count": 4,
        "favorite_count": 5,
        "entities": {
            "hashtags": [],
            "symbols": [],
            "user_mentions": [{
                "screen_name": "JoeMayo",
                "name": "Joe Mayo",
                "id": 15411837,
                "id_str": "15411837",
                "indices": [39, 47]
            }],
            "urls": [],
            "media": [{
                "id": 676817604057497600,
                "id_str": "676817604057497600",
                "indices": [90, 113],
                "media_url": "http:'/'/pbs.twimg.com'/media'/CWSKBmOUAAAqsr2.png",
                "media_url_https": "https:'/'/pbs.twimg.com'/media'/CWSKBmOUAAAqsr2.png",
                "url": "https:'/'/t.co'/CBkJL4KS5Q",
                "display_url": "pic.twitter.com'/CBkJL4KS5Q",
                "expanded_url": "http:'/'/twitter.com'/Dotnetster'/status'/676817605064290306'/photo'/1",
                "type": "photo",
                "sizes": {
                    "large": {
                        "w": 1024,
                        "h": 535,
                        "resize": "fit"
                    },
                    "thumb": {
                        "w": 150,
                        "h": 150,
                        "resize": "crop"
                    },
                    "medium": {
                        "w": 600,
                        "h": 313,
                        "resize": "fit"
                    },
                    "small": {
                        "w": 340,
                        "h": 177,
                        "resize": "fit"
                    }
                }
            }]
        },
        "extended_entities": {
            "media": [{
                "id": 676817604057497600,
                "id_str": "676817604057497600",
                "indices": [90, 113],
                "media_url": "http:'/'/pbs.twimg.com'/media'/CWSKBmOUAAAqsr2.png",
                "media_url_https": "https:'/'/pbs.twimg.com'/media'/CWSKBmOUAAAqsr2.png",
                "url": "https:'/'/t.co'/CBkJL4KS5Q",
                "display_url": "pic.twitter.com'/CBkJL4KS5Q",
                "expanded_url": "http:'/'/twitter.com'/Dotnetster'/status'/676817605064290306'/photo'/1",
                "type": "photo",
                "sizes": {
                    "large": {
                        "w": 1024,
                        "h": 535,
                        "resize": "fit"
                    },
                    "thumb": {
                        "w": 150,
                        "h": 150,
                        "resize": "crop"
                    },
                    "medium": {
                        "w": 600,
                        "h": 313,
                        "resize": "fit"
                    },
                    "small": {
                        "w": 340,
                        "h": 177,
                        "resize": "fit"
                    }
                }
            }]
        },
        "favorited": false,
        "retweeted": false,
        "possibly_sensitive": false,
        "lang": "en"
    },
    "is_quote_status": false,
    "retweet_count": 4,
    "favorite_count": 0,
    "entities": {
        "hashtags": [],
        "symbols": [],
        "user_mentions": [{
            "screen_name": "Dotnetster",
            "name": "Ross McLoughlin",
            "id": 26903787,
            "id_str": "26903787",
            "indices": [3, 14]
        }, {
            "screen_name": "JoeMayo",
            "name": "Joe Mayo",
            "id": 15411837,
            "id_str": "15411837",
            "indices": [55, 63]
        }],
        "urls": [],
        "media": [{
            "id": 676817604057497600,
            "id_str": "676817604057497600",
            "indices": [106, 129],
            "media_url": "http:'/'/pbs.twimg.com'/media'/CWSKBmOUAAAqsr2.png",
            "media_url_https": "https:'/'/pbs.twimg.com'/media'/CWSKBmOUAAAqsr2.png",
            "url": "https:'/'/t.co'/CBkJL4KS5Q",
            "display_url": "pic.twitter.com'/CBkJL4KS5Q",
            "expanded_url": "http:'/'/twitter.com'/Dotnetster'/status'/676817605064290306'/photo'/1",
            "type": "photo",
            "sizes": {
                "large": {
                    "w": 1024,
                    "h": 535,
                    "resize": "fit"
                },
                "thumb": {
                    "w": 150,
                    "h": 150,
                    "resize": "crop"
                },
                "medium": {
                    "w": 600,
                    "h": 313,
                    "resize": "fit"
                },
                "small": {
                    "w": 340,
                    "h": 177,
                    "resize": "fit"
                }
            },
            "source_status_id": 676817605064290306,
            "source_status_id_str": "676817605064290306",
            "source_user_id": 26903787,
            "source_user_id_str": "26903787"
        }]
    },
    "extended_entities": {
        "media": [{
            "id": 676817604057497600,
            "id_str": "676817604057497600",
            "indices": [106, 129],
            "media_url": "http:'/'/pbs.twimg.com'/media'/CWSKBmOUAAAqsr2.png",
            "media_url_https": "https:'/'/pbs.twimg.com'/media'/CWSKBmOUAAAqsr2.png",
            "url": "https:'/'/t.co'/CBkJL4KS5Q",
            "display_url": "pic.twitter.com'/CBkJL4KS5Q",
            "expanded_url": "http:'/'/twitter.com'/Dotnetster'/status'/676817605064290306'/photo'/1",
            "type": "photo",
            "sizes": {
                "large": {
                    "w": 1024,
                    "h": 535,
                    "resize": "fit"
                },
                "thumb": {
                    "w": 150,
                    "h": 150,
                    "resize": "crop"
                },
                "medium": {
                    "w": 600,
                    "h": 313,
                    "resize": "fit"
                },
                "small": {
                    "w": 340,
                    "h": 177,
                    "resize": "fit"
                }
            },
            "source_status_id": 676817605064290306,
            "source_status_id_str": "676817605064290306",
            "source_user_id": 26903787,
            "source_user_id_str": "26903787"
        }]
    },
    "favorited": false,
    "retweeted": false,
    "possibly_sensitive": false,
    "lang": "en"
}

注意JSON的底部retweetedfalse,但retweeted_status显然有一个关联的JSON对象。在这条推文中,我确实点击了Twitter 转发按钮,如下所示:

https://twitter.com/Dotnetster/status/676817605064290306

注意:您可以在查询完成后通过检查TwitterContext实例RawResult来访问任何查询的JSON。