Twitter Streaming API not working - twitter-streaming-api

When I try this on terminal:
curl https://stream.twitter.com/1.1/statuses/filter.json?delimited=length&track=twitterapi:
It returns this html document:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Error 401 Unauthorized</title>
</head>
<body>
<h2>HTTP ERROR: 401</h2>
<p>Problem accessing '/1.1/statuses/filter.json?delimited=length'. Reason:
<pre> Unauthorized</pre>
</body>
</html>
It's supposed to return lots of json data, any thoughts why this is happening?

You have to "login" with twitter before you can use most of the APIs.
Read Authentication & Authorization.

Related

Some functions if the Telegram Bot WebApp is not working

thanks for your attention.
This is a simple webpage for a web-app bot.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bot Web App</title>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
</head>
<body>
<button onclick="Telegram.WebApp.HapticFeedback.impactOccurred('heavy');">Feedback</button>
<button onclick="Telegram.WebApp.expand();">Expand WebView</button>
<button onclick="Telegram.WebApp.close();">Close WebView</button>
</body>
</html>
Expand and close button working fine. The issue is with haptic feedback.
It is not working, not even the showScanQrPopup() or some other functions.
Can anyone tell me what is the issue? Or how to do them if my method is wrong?
My final target is to create a telegram bot that will scan a qr code and send the code data to the server to process. And the server (bot) will send a confirmation message. The qr code must be scanned like #easyqrscanbot

Vue app works in browser throws "Javascript not enabled" through CURL

When I open my vue app's URL in browser it loads the application. But, when I tried to call the URL with curl in terminal it returns the error
CURL https://vue-app-url.com/
OUTPUT:
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]-->
<title>VUE APP</title>
<link href="/app.js" rel="preload" as="script"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="app-vue"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head>
<body>
<noscript>
<strong>We're sorry but app-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="text/javascript" src="/app.js"></script></body>
</html>
As curl will only load the markup this seems to be the correct output. If you add a noscript to a page where the "real" content is loaded or added via Javascript then you will get the noscript via curl. As curl is not loading additional resources.
Try also this commands probably you will get a bit better output:
curl --location https://vue-app-url.com/
or
curl --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" https://vue-app-url.com/
Also try removing your noscript just to test it via curl.
Update (better example):
If you add a vue component to you html, lets say:
<feedback-form>Some feedback</feedback-form>
curl will render:
<div id="app"><feedback-form>Some feedback</feedback-form></div>
So everything is ok with your app just the JS is not getting parsed. Its like the source code of you page not the code in your devtools (which is parsed).

angular6 loading issue with opensocial.googleusercontent.com

Deployed angular 6 app (using angular material) in ngnix.
Login page navigation has no issue. Using fire-base auth and post login authentication, navigating to the login successful page but getting the below error shown in console and page load stops (hangs) here.
Page load starts again if i resize the window.
This error is coming from www-opensocial.googleusercontent.com/gadgets/rpc/rpc.v.js, not sure what is causing this error
rpc.v.js:23 Uncaught TypeError: Cannot read property 'register' of undefined
at Object.init (rpc.v.js:23)
at Object.init (rpc.v.js:276)
at rpc.v.js:284
My index file
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tradingapp9</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- This is for google authentication -->
<!--script src="https://apis.google.com/js/platform.js"></script-->
<script src="https://apis.google.com/js/platform.js" async defer></script>
<!-- This is for google authentication -->
</head>
<body>
<app-root></app-root>
</body>
</html>
Not getting anyinput from google search

Got console error `unexpected token <` from sign in page (using keystonejs 4.0 beta4)

I've added keystone to my existing MERN server with webpack. Server started with no error.
However, when I try to access /keystone/signin (which redirected by /keystone) it gives a blank page and console error Uncaught SyntaxError: Unexpected token < from signin?from=/keystone/js/packages.js:1 and signin?from=/keystone/js/signin.js:1
The content in signin.js is
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Sign in to OneCharge</title>
<link rel="stylesheet" href="/keystone/styles/keystone.min.css">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
</head>
<body>
<div id="signin-view"></div>
<script>
var Keystone = {"adminPath":"/keystone","brand":"My Site","csrf":{"header":{"x-csrf-token":"vIRAZlZwZae640a645fd60ed9e8ca9911111a05ce088c8095c"}},"from":"/keystone/js/signin.js","userCanAccessKeystone":false};
</script>
<script src="/keystone/js/packages.js"></script>
<script src="/keystone/js/signin.js"></script>
</body>
</html>
Any hints to solve that could help.
I found a solution to the problem, answering my own question here.
Turns out following the guide here doesn't work for me How to add keystone to an existing express app.
After looking up the code from keystone repository. I found a test project that have everything I need and maybe other people who want to use keystone.
I followed the configuration from the test project repo and work like a charm!

SoundCloud: callback.html popup doesn't close

I've registered my SoundCloud app.
I'm trying to implement the SoundCloud JS example code with the "callback.html" API
https://developers.soundcloud.com/docs/api/sdks#authentication http://connect.soundcloud.com/examples/recording.html
When I upload a recording, I get the authorization-login popup.
After I login, the popup says "This popup should auto close..."
But the popup doesn't close.
And the recording isn't uploaded.
I'm positive SC.initialize has my correct "clientID" and is referencing "callback.html" correctly from my directory.
Am I missing something? maybe "client secret"?
SC.initialize({
client_id: "xxxxxxxxxxxxxxxxxxxxxx",
redirect_uri: "http://www.example.com/callback.html"
});
One time (fluke) instead of the normal pop msg "This should close", the message said "502 Bad Gateway". But I havent been able to reproduce this msg.
SoundCloud's sample code is broken.
This is from SoundCloud's callback.html
<body onload="window.opener.setTimeout(window.opener.SC.connectCallback, 1)">
This is how I got it to work:
<body onload="window.setTimeout(window.opener.SC.connectCallback, 1)">
SoundCloud's connectCallback uses this.location to collect the OAuth access token. If you set the timeout on window.opener, inside connectCallback this will refer to your app's window and the location will be your main page. Whereas setting it on window will bind this to the callback popup window, and this.location will contain the access token in the query arguments.
I also faced the same issue, and found the solution, if you change your callback.html to below two options, it will work -
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Connect with SoundCloud</title>
</head>
<body onload="window.opener.setTimeout(window.opener.SC.connectCallback, 1)">
<b style="text-align: center;">This popup should automatically close in a few seconds</b>
<script type="text/javascript">
window.opener.SC.connectCallback.call(this);
</script>
</body>
</html>
Or
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Connect with SoundCloud</title>
</head>
<body onload="setTimeout(window.opener.SC.connectCallback)">
<b style="text-align: center;">This popup should automatically close in a few seconds</b>
</body>
</html>