Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not detecting mentions with mixed cases #2

Closed
blessenm opened this issue Oct 27, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@blessenm
Copy link
Owner

commented Oct 27, 2015

Certain mentions are not getting replaced. This because the mentions screen_name are converted to lowercase before doing a replace. For username mentions that mix cases, the replace will fail. Fixed it locally using a regex. Needs a test before pushing to remote.

var regex = new RegExp('@' + userObj.screen_name, 'gi' );

JSON
{
"created_at": "Tue Oct 27 09:42:06 +0000 2015",
"id": 658941734139875300,
"id_str": "658941734139875329",
"text": ".@realDonaldJS There are Haskell fundamentalists who uh have training camps and uh, what I mean is, when can we get rid of them?",
"source": "<a href="http://www.twitter.com\" rel="nofollow">Twitter for Windows Phone",
"truncated": false,
"in_reply_to_status_id": 655468867779739600,
"in_reply_to_status_id_str": "655468867779739648",
"in_reply_to_user_id": 3981786520,
"in_reply_to_user_id_str": "3981786520",
"in_reply_to_screen_name": "realDonaldJS",
"user": {
"id": 160514302,
"id_str": "160514302",
"name": "Richard Dalton",
"screen_name": "richardadalton",
"location": "Kildare, Ireland",
"description": "I write code, as a last resort. I make it simple, when I can. Please visit: http://t.co/GtWXf7dbfa",
"url": "http://t.co/mArwXmywZl",
"entities": {
"url": {
"urls": [
{
"url": "http://t.co/mArwXmywZl",
"expanded_url": "http://www.devjoy.com",
"display_url": "devjoy.com",
"indices": [
0,
22
]
}
]
},
"description": {
"urls": [
{
"url": "http://t.co/GtWXf7dbfa",
"expanded_url": "http://freepaconow.com",
"display_url": "freepaconow.com",
"indices": [
76,
98
]
}
]
}
},
"protected": false,
"followers_count": 1069,
"friends_count": 504,
"listed_count": 97,
"created_at": "Mon Jun 28 11:27:14 +0000 2010",
"favourites_count": 231,
"utc_offset": null,
"time_zone": null,
"geo_enabled": true,
"verified": false,
"statuses_count": 28390,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "C0DEED",
"profile_background_image_url": "http://pbs.twimg.com/profile_background_images/687927535/b2ebf72ba8fc96d4e126d2810c37467a.jpeg",
"profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/687927535/b2ebf72ba8fc96d4e126d2810c37467a.jpeg",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/629300041455435776/dCbJf6WT_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/629300041455435776/dCbJf6WT_normal.jpg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/160514302/1357347025",
"profile_link_color": "0084B4",
"profile_sidebar_border_color": "FFFFFF",
"profile_sidebar_fill_color": "DDEEF6",
"profile_text_color": "333333",
"profile_use_background_image": true,
"has_extended_profile": false,
"default_profile": false,
"default_profile_image": false,
"following": true,
"follow_request_sent": false,
"notifications": false
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"is_quote_status": false,
"retweet_count": 0,
"favorite_count": 0,
"entities": {
"hashtags": [],
"symbols": [],
"user_mentions": [
{
"screen_name": "realDonaldJS",
"name": "Trump on JavaScript",
"id": 3981786520,
"id_str": "3981786520",
"indices": [
1,
14
]
}
],
"urls": []
},
"favorited": false,
"retweeted": false,
"lang": "en"
}

@blessenm blessenm added the bug label Oct 27, 2015

blessenm added a commit that referenced this issue Oct 27, 2015

@blessenm blessenm closed this Oct 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.