linqtotwitter 转推未显示为来自流的转推

linqtotwitter retweets not appearing as retweets from stream

我正在使用 linqtotwitter (v3.1.2) 库将推文流式传输到应用程序中,但我们不想处理转推。当我收到转发时,转发的属性和 RetweetedStatus.ID 始终为 false 和 0.

这是库中的错误吗?我查看了 GitHub 中的源代码,看起来应该可以。

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

这似乎是库中的错误。我通过检查推文文本是否以 "RT " 开头来解决这个问题。不理想,但对我有用。

Twitter API 将 retweeted 设置为 false,这就是为什么返回的 Status 实体中的 Retweeted 属性 是 false。鉴于此,您可以做两件事来跟踪转推:

  1. 您可以像您一样检查以 RT 开头的推文,因为有些人仍然会这样转推,而不是单击 Retweet按钮。
  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。