question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

User is unable to open url's shortened by Twitters URL shortener

See original GitHub issue
  • System: Kubuntu 18.04
  • Python version: 2.7
  • rainbowstream v 1.3.7

Repro:

  1. Launch rainbowstream

  2. Locate a tweet that contains a URL shortened by Twitters URL shortener(https://t.co/wNYPltI7ll ) image

  3. Type open id#

Expected:

  • The link will open in the default web browser.

Bug:

  • No url here @.@! is displayed.

Additional Notes:

  • I’ve confirmed that bit.ly and ow.ly shortened links open correctly in my setup.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
RandomCorecommented, Jun 15, 2019

I don’t know any Python, but I was able to figure out some workaround for the “No url here @.@” problem. It seems the problem is based on the place of the shown URL in the Twitter API return value for a tweet. So adding some code in rainbow.py function urlopen() to find different places for the URLs does the magic:

def urlopen():
    ...
    urls = tweet['entities']['urls']
    if not urls:
        try:
            urls = tweet['entities']['media']
        except:
            urls = {}
    if not urls:
        try:                                                                                    
            urls = tweet['retweeted_status']['quoted_status']['entities']['urls']               
        except:                                                                                 
            urls = {}                                                                           
                                                                                                   
    if not urls:                                                                                
        printNicely(light_magenta('No url here @.@!'))                                          
        return
    ...

I don’t know, if I have found all places for URLs. Maybe someone can improve on this.

0reactions
nstr10commented, Oct 18, 2018

It looks like the URLs are provided by Twitter’s API library, so this may need to be addressed upstream.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Twitter link shortener (t.co) and how it works
Twitter automatically shortens links within Tweets or Direct Messages. Find FAQ surrounding t.co links.
Read more >
Safari Not Opening t.co Short Links from Twitter? Quick Fixes
8 Techniques to Open t.co Short Links from Twitter on iPad, iPhone & Mac · 1. Reload the URL · 2. Remove 's'...
Read more >
Workarounds for Safari Not Opening t.co Short Links from Twitter
The simplest workaround is simply to reload the t.co short link several times until the link eventually responds and loads as expected.
Read more >
Why doesn't Twitter's URL shortening always work?
Sometimes URLs can be harmful, so please be careful when clicking on links that were shortened using an external link shortening service.
Read more >
Twitter auto shorten URL not working - Stack Overflow
Do note that Twitter shortens all URLs, even when "shortening" actually makes them longer. For example, "http://bit.ly" will use up 22 characters (not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found