How to add a parameter to a link in Telegram instant view template - xpath

I want to measure the visits coming from my own Telegram channel by adding an url parameter to a link to the original article on the end of my Telegram template.
Actually I produce this link like that
?exists: //link[#rel="canonical"]
#append(<a>, href, //link[#rel="canonical"]/#href, title, "👉 Have a look on the original article"): $body
$page_link: $#
#append(#title): $page_link
#append_to($body)
#wrap(<p>): $page_link
This sets a link on the end of the body like that:
👉 Have a look on the original article
But I have no idea how to manipulate the href by adding some parameters like ?utm_source=telegram&utm_campaign=iv

Related

Why does twitter API add url at the end of the text

When getting tweet information using the twitter API, the returned text or full_text field has a URL appended at the end of the text. For example:
"full_text": "Just another Extended Tweet with more than 140 characters, generated as a documentation example, showing that [\"truncated\": true] and the presence of an \"extended_tweet\" object with complete text and \"entities\" #documentation #parsingJSON #GeoTagged https://twitter.com/FloodSocial/status/994633657141813248"
https://twitter.com/FloodSocial/status/994633657141813248 is appended at the end(The appended url is acutally a shortened url but stackoverflow does not allow shortened url in the body so I just replace it with the full URL). Why does the API add this and is there a way to get the text without the added URL?
Are you using the correct twitter gem? using gem install twitter and setting up a client according to the docs, you should be able to just get the tweet/status by it's ID. But whatever example you are using doesn't show how you got the full text
text = client.status('994633657141813248').text
=>"Just another Extended Tweet with more than 140 characters, generated as a documentation example, showing that https://twitter.com/FloodSocial/status/994633657141813248"
The url is truncated as a plain string so not sure what you even do to get the string you formulated.
But if you have some long string somehow with the url embedded, you could do
text.split(/\shttp?s/).first
That looks like a quote Tweet where the original Tweet URL is included?
[edit - I was wrong with the above statement]
I see what is happening. The original Tweet links to an image on Twitter (https://twitter.com/FloodSocial/status/994633657141813248/photo/1, via a shortened tco link). Twitter hides the image URL in the rendered Tweet, but returns it in the body of the text. That's the expected behaviour in this case. You can also see the link parsed out in the extended_entities segment of the Tweet data, as well as the image data itself in the same area of the Tweet. If you want to omit the URL from the text data, you'll need to trim it yourself.

How can I get URL information following "#" in Koa

I have a URL that in the browser shows like this https://localhost:3000/location#valueIwant=1234.
I am trying to get access to the valueIwant value but all of the items I try ctx.request.path, ctx.request.href, etc but all seem to not have the values after #. How do I parse this part of the url.
Also this is coming from a redirect.
Everything after the # is not sent to the server. The purpose of the fragment is to create a link to a specific subsection of a page.
If you want to send specific parameters to the server, the right way to do it is to use the query part (everything after ?), not the fragment part. This is by design.

How to write a post routing request which takes multiple links Sinatra

I basically want to write a POST request in sinatra that has to take 3 links at the same time and process it in someway.
post account/:id/
Here id represents the user id...what will come after
:id/
so that I can capture 3 links like link1, link2, link3 and then do something with it inside the POST request?
Doing this with interpolated path variables is very inflexible. Rather do it by accepting a posted array of parameters
If you absolutely have to do this; the syntax is something like
post 'account/:id/link1/:link1/link2/:link2/link3/:link3'

Is it possible to use nested merge tags in Mandrill?

Is it possible to use nested merge tags?
What we need is to be able to define the UNSUB tag depending on the values from other merge tags, like on this example:
<a
href="*|UNSUB:*|COMMUNITYURL|*/site/unsuscribe/user_id/*|USERID|*/hash/*|HASH|*/type/all|*">
Unsubscribe
</a>
Is this correct?
Should be done in a different way?
It's not currently possible to nest merge tags. In this case, your best bet would be to add your own List-Unsubscribe headers (using the headers parameter in the API) and pass either your own URL, or a URL constructed with your merge tags but not the UNSUB merge tag.
From the API:
What happens when the [unsubscribe] link is clicked?
If a recipient clicks the generated link, the message status is changed to Unsubscribed and > the recipient's address is added to the Rejection Blacklist in your
Mandrill account. The redirect URL will be appended to include two
querystring parameters that can be used for processing the unsubscribe
in your own system or database:
md_id - the _id, as provided in the API call and webhooks of the
specific message where the unsubscribe link was clicked
md_email - a URL-encoded version of the recipient's email address
So you don't have to worry about generating an unsubscribe url for every user. Just put a generic url and mandrill automatically will append to you the email of that user in the md_email variable.
The documentation suggest that you do this then:
Click here to unsubscribe.
And mandrill will append the correct user email and id:
http://mywebsite.com/unsub?md_email=fulanito#gmail.com&m_id=23321
Since mandrill doesn't support nested merge tags, here is the solution for the case like yours if you dont mind after user click unsub, it did't go to mandrill's black list, since the unsubsription are all handled by your app.
PER YOUR CASE:
Manually compose your unsubscribe link
e.g.
*|COMMUNITYURL|*/site/unsuscribe/user_id/*|USERID|*/hash/*|HASH|*/type/all/
At the end of your link, append the mandrill recipient email var.email=*|EMAIL|* e.g.
*|COMMUNITYURL|*/site/unsuscribe/user_id/*|USERID|*/hash/*|HASH|*/type/all/?email=*|EMAIL|*
Put the link to your mandrill template
Unsubscribe Me
reference: mandrill doc

How I can open a new tab in a Firefox add-on with POST variables?

How I can open a new tab in a Firefox add-on with POST variables?
For example, open http://localhost/ with these post variables:
a=NOMADE
b=NOWAY
another=IDONTKNOW
The gBrowser.addTab function is what you want. One of the parameters you pass to that function is postData, and allows you to set the postData as you would like it. The MDN documentation for that function also points to an article on pre-processing POST data. If I read that second article correctly, the POST data needs to be passed in the form of an nsIInputStream (specifically created as nsIMIMEInputStream). The article provides a sample code snippet for converting from a standard GET style format string (example: foo=1&goo=somestring) to the intended format.
Edit: So, to use your example, you might do something like this:
var myData = "a=NOMADE&b=NOWAY&another=IDONTKNOW";
// TODO: Translate myData into the nsIMIMEInputStream format using the example
// from the second linked article above
// Add the tab, with the variable data
gBrowser.addTab("http://www.example.com/", {postData: myData});

Resources