lmammino / tall Goto Github PK
View Code? Open in Web Editor NEWPromise-based, No-dependency URL unshortner (expander) module for Node.js
Home Page: https://lmammino.github.io/tall/
License: MIT License
Promise-based, No-dependency URL unshortner (expander) module for Node.js
Home Page: https://lmammino.github.io/tall/
License: MIT License
No matter what URL I ask for, all I get is https://slides.com/lucianomammino/universal-js-web-applications-with-react-codemotion-rome-2017
Code:
var { tall } = require('tall')
tall('http://www.loige.link/codemotion-rome-2017')
.then(unshortenedUrl => console.log(`Expanded URL: ${unshortenedUrl}`))
Hi,
As investigating while trying to get this work with array of urls => does not work?
If there is a away to do it, write it down?
Simple as but not able to get it work.
Hi,
I have a issue when i try to unshort a bitly ebay link (https://ebay.to/xxxxx). The method return www.ebay.com url only. Someone have the same issue?
When using tall() inside a try/catch block, the following kind of error isn't thrown and catchable, but instead, the node process exits with:
Error: connect ETIMEDOUT 216.70.100.245:80
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
The URL was http://bit.ly/nitioninfo
Using tall v2.2.0
Hey there,
I tried upgrading from v2 to v3 and youtube links are not resolved anymore. You may try this example I took from the README:
import { tall } from 'tall';
async function someFunction() {
try {
const LINK = 'https://youtu.be/TCB_RSlgTqY';
const unshortenedUrl = await tall(LINK, {
maxRedirect: 10
});
console.log('Tall url', unshortenedUrl);
} catch (error) {
console.error('AAAW ๐ป', error);
}
}
someFunction();
Am I doing something wrong?
Thanks in advance,
When using tall() inside a try/catch block, the following kind of error isn't thrown and catchable, but instead, the node process exits with:
Error: getaddrinfo ENOTFOUND XXXXXX XXXXXX
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)
Hey @lmammino ๐ hope things are going well!
In our experience with using tall
against a large number of domains, some domains will refuse to send back a response without a certain set of headers.
Some of these headers could be set automatically by tall
as default options to improve out-of-the-box compatibility (there are libraries to keep up to date with latest Accepts
and User-Agents
values):
const accepts = [
// Chrome 112
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
// Firefox 113
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
];
const userAgents = [
// Chrome 112
'Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Mobile Safari/537.36',
// Firefox 113
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0'
]
tall(url, {
headers: {
'Accept-Encoding': 'gzip, deflate, br',
Connection: 'keep-alive',
Accept: accepts[Math.floor(Math.random() * (accepts.length - 1))],
'User-Agent':
userAgents[Math.floor(Math.random() * (userAgents.length - 1))],
},
});
What do you think about setting these as default headers
options?
When following: http://www.awin1.com/awclick.php?mid=8025&id=451975
it resolved into: https://www.awin.com/nl
i'm getting the following error: Error: Invalid url: /nl
async function somefuction() {
try {
const link = 'http://www.awin1.com/awclick.php?mid=8025&id=451975'
const unshortenedUrl = await tall(link)
console.log(unshortenedUrl)
}
catch (err){
console.log('some issue', err)
}
}
Often times the tall URL is a link to another URL shortening service. It would be good to be able to return the conclusive final URL.
I can't seem to get this to work. I have installed the package, and I am running nextjs.
Here is my code:
import { tall } from 'tall';
var airbnblink = 'https://abnb.me/YEO24YyMisb';
tall(airbnblink).then(function(response) {
console.log(response);
})
.catch(function(err) {
console.log(err);
})
But I can't get this to run - console keeps saying:
TypeError: The "listener" argument must be of type Function. Received type object
Any ideas why?
When using tall, I get the error mentioned in the title. I'm using Firebase to run my code.
Here's my package.json:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "14"
},
"main": "index.js",
"dependencies": {
"firebase-admin": "^9.2.0",
"firebase-functions": "^3.11.0",
"needle": "^2.6.0",
"tall": "^4.0.1",
"twilio": "^3.62.0"
},
"devDependencies": {
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0",
"firebase-functions-test": "^0.2.0"
},
"private": true
}
Here's my code:
const tall = require("tall");
...
async function unshortenLink(link) {
var fullLink = null;
try {
fullLink = await tall(link);
} catch (err) {
console.log("Error: tall did not unshorten link. Link: ", link);
console.log("Error: tall did not unshorten link: ", err);
}
return fullLink;
}
Any help would be appreciated.
Hi @lmammino ! ๐
It seems like running tall
on the https://eyeondesign.aiga.org/the-era-of-nonchalant-web-design-is-here/
website on a deployed Ubuntu environment fails with a certificate validation error.
const {tall} = require('tall')
tall('https://eyeondesign.aiga.org/the-era-of-nonchalant-web-design-is-here/')
> Uncaught Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
at TLSSocket.emit (node:events:390:28)
at TLSSocket.emit (node:domain:537:15)
at TLSSocket._finishInit (node:_tls_wrap:944:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12)
at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
The certificate for the website is valid in the browser:
Following the advice from Stack Overflow I tried installing [email protected]
to install the root CAs, but this did not change anything for tall
... ๐ค
Similar to #5
following: http://www.awin1.com/awclick.php?mid=8061&id=451975',
returns:
Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
at TLSSocket.emit (events.js:182:13)
at TLSSocket._finishInit (_tls_wrap.js:631:8)
Hello,
I know this was supposedly handled in #12 but I have2.2.0
installed (the one with this PR) and it seems to still fail when fed a shortened URL pointing to an invalid URL. I'd like to know if it's me handling this poorly somehow or if the bug is still present.
How to reproduce:
z.chat
tall
: tall("https://t.co/FqLTQ7TRYS")
Error: getaddrinfo ENOTFOUND z.chat z.chat:80
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:58:26)
Emitted 'error' event at:
at Socket.socketErrorListener (_http_client.js:397:9)
at Socket.emit (events.js:193:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:81:17)
Am I missing something, am I handling the promise rejection wrong?
const promises = urls.map((shortUrl, idx) =>
tall(shortUrl).then(longUrl => ({
shortUrl,
longUrl,
idx
}))
);
Promise.all(promises)
.then(results => {
// Handle success
})
.catch(e => {
// THIS NEVER GETS CALLED
log("The elusive buggerino!");
log(`Total message: ${text}`);
log(`URL we tried shortening: ${shortUrl}`);
log(e);
});
Thanks for your time
Hi @lmammino ๐
First of all, thanks so much for creating and maintaining this module, super simple and works!
What are your thoughts on supporting unshortening the <meta http-equiv="refresh" />
redirects that pages can return in the response body?
For example, the html below would instantly redirect to https://example.com/abc/
:
<html>
<head>
<meta http-equiv="refresh" content="0;url=https://example.com/abc/">
</head>
<body></body>
</html>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.