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.

Sharing "locationHref" to Telegram

See original GitHub issue

Hi, I know this is a very specific request but is it possible to add an option to get window.location.href.

For example instead of: tg://msg_url?url={searchTerms} it will be tg://msg_url?url={locationHref}

For now I use tg://msg_url?url={searchTerms} and paste URL into input field myself and it works but getting locationHref as variable would be great. image

Another use case for this could be opening URL with a proxy, for example https://proxy.duckduckgo.com/iu/?u=https://i.imgur.com/AD3MbBi.jpg

It’s still very specific 😃 but it would be great if you consider.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
CanisLupuscommented, Mar 21, 2020

Glad I could help. 😃

Regex is very useful in some situations, though it can be hard to visually parse! The rules are mostly simple, however. I think it’s a useful skill. 😃

1reaction
CanisLupuscommented, Mar 20, 2020

Hey @mortyobnoxious, in version 3.41.1 (just updated) I added support for modifications on the URL variables. In general, you can use {href{replace_this|with_this}}, but URLs like https://twitter.com/BernieSanders/status/1233962400556122112 are different every time, so we need to use regular expressions (not sure if you are familiar with those at all) to try and remove everything that is not the number/ID.

So to filter out 1233962400556122112 from an href like https://twitter.com/BernieSanders/status/1233962400556122112 you could use (sorry, this is ugly xD):

{href{re/[^\d]+/g|}}

In practice:

     {re/[^\d]+/g  	// match anything that is NOT a number...
                 |} 	// and replace it with nothing

However, if the username “BernieSanders” was “B3rni3S4nd3rs”, you’d get _3343_1233962400556122112, so we need something better (i.e. even uglier) like this:

{href{re/.+\/status\/(\d+).+/|$1}}

It basically matches all possible characters with .+, then /status/, then a sequence of digits with \d+, and then finally anything irrelevant that might come after in the URL with .+ again. Then it replaces ALL of that with just the thing we placed in parenthesis, which is the number given by (\d+).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Share a link via URL scheme to Telegram - Stack Overflow
Always use the NEW way: https://t.me because it will open the Telegram DESKTOP app in Windows\Linux\Mac IF THE USER WANTS\HAS it, otherwise it ......
Read more >
Sharing Button - Telegram APIs
A Telegram Sharing Button is an easy way to let users forward content from your website or app to their friends, Channels or...
Read more >
How to create links to phone, WhatsApp, Telegram, Skype etc.
1. Link to open a chat · 2. Link to open a chat and send a message: · 3. Share the text.
Read more >
How to Easily Add Share Links for Each Social Media Platform
In this tutorial, we'll go over how we can add a share link for each social media platform directly in our HTML.
Read more >
How to Copy Telegram Profile, Group, Channel, Message Links
1. Open the Telegram app and go to the channel whose public link you want to copy and share with others. Tap on...
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