linqtotwitter转发不会从流中转发出来

时间:2015-08-04 10:41:58

标签: c# linq-to-twitter

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

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

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

2 个答案:

答案 0 :(得分:0)

这似乎是图书馆中的一个错误。我通过检查推文文本是否以" RT"开头来编码问题。不理想,但它符合我的目的。

答案 1 :(得分:0)

Twitter API将retweeted设置为false,这就是返回的Retweeted实体中的Status属性为false的原因。鉴于此,您可以采取两项措施来跟踪转推:

  1. 您可以查看以 RT 开头的推文,因为有些人仍会像这样转发,而不是点击转发按钮。
  2. 查看RetweetedStatus实体的Status属性。如果是转推,则这将是有效的Status实例。如果它不是转发,RetweetedStatus将为空。
  3. 就像我说的,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。

相关问题