Extract audio stream from http site (online radio) - http

I'm new here so firstly sorry for all my mistakes.
I'm trying to add one more radio station to my raspberryPi based online radio player (of course for private use only). It is an polish radio, radio Wawa. Here is the official site and stream: https://www.eskago.pl/radio/wawa But unfortunately on official site there are some adds before stream start (and I don't see the stream url :( ). I found an unofficial site with stream: https://pl.radioonline.fm/sluchac/Radio-WAWA Here there is no adds but still it's some complicated for me to extract stream which would be useful to play e.g. in omxplayer.
I found that the url for stream is http://waw.ic.smcdn.pl/t050-1.aac but the site is adding to this url a timestamp and a mistery hash. Full request looks like:
http://waw.ic.smcdn.pl/t050-1.aac?timestamp=1546208561&hash=25d2e0deebc354c9e9b5c37b74b64f21
Now is the question: is it possible to play this with command line only (the best option with omxplayer)? And how?
Thanks.

Related

How to know if a user clicked a link using its network traffic

I have large traffic files that I'm trying to analyze in order to get statistical features of users.
One of the features that I would like to extract is links clicking in specific sites (for examples - clicking on popups and more)
My first idea was to look in the packets' content and search for hrefs and links, save them all in some kind of data structure with their time stamps, and then iterate again over the packets to search for requests at any time close to the time the links appeared.
Something like in the following pseudo code (in the following code, the packets are sorted by flows (flow: IP1 <=> IP2)):
for each packet in each flow:
search for "href" or "http://" or "https://"
save the links with their timestamp
for each packet in each flow:
if it's an HTTP request and its URL matches any URL in the list and the
time is close enough, record it
The problem with this code is that some links are dynamically generated while the page is loading (using javascript or so), and cannot be found using the above method.
I have also tried to check the referrer field in the HTTP header and look for packets that were referred by the relevant sites. This method generates a lot of false positives because of iframes and embedded objects.
It is important to mention that this is not my server, and my intention is to make a tool for statistical analysis of users behavior (thus, I can't add some kind of click tracker to my site).
Does anyone have an idea what can I do in order to check if the users clicked on links according to their network traffic?
Any help will be appreciated!
Thank you

Token image in Google Authenticator or FreeOTP

For a project, I implemented an OTP 2nd factor authentification. Everything is working fine, I am able to generate a QRcode for the encryption seed, read it on an Androïd smartphone and use the 6 digits generated code to authenticate in my app.
I read that v1.5 of FreeOTP is now supporting addition of an image to each service, quote:
On Android, we released a major release which brings many new features and UI refinements. The biggest of these is image support. Images can be selected for each token. Images can also be provisioned to the device via an undocumented OTP URI query parameter.
I see that some services did succeed in adding an image for their service (for example OVH), but cannot find the proper URI syntax to do so ...
To be more precise, I am not asking for the method to manually add an image to a token in the FreeOTP app, I'm looking for the correct URI to generate the QRCode that would ideally include a link to the image to be displayed. I'm pretty sure I never manually added an image for OVH.
The correct URI to generate the QR code with reference to the image you want to use in FreeOTP includes a querystring parameter pointing to its publicly available location:
...&image=http<s>://<image-path>
The image should be a .png. Fully qualify path and protocol.
Add this to the existing string already created for the QR code. You have to UrlEncode the whole string before generating the QR code.
For clarity the format of the data before urlencoding should be:
otpauth://totp/(<issuer>:)<accountnospaces>?secret=xxxxxxxxxx(&issuer=<issuer>)(&image=<imageuri>)
Brackets denote optional elements. For example:
otpauth://totp/Google:SampleName?MQ2TQNLEGMYTMOBXGY3Q&issuer=Google&image=http://google.com/image/logo.png
Then you urlencode it:
otpauth%3A%2F%2Ftotp%2FGoogle%3ASampleName%3FMQ2TQNLEGMYTMOBXGY3Q%26issuer%3DGoogle%26image%3Dhttp%3A%2F%2Fgoogle.com%2Fimage%2Flogo.png
Then you generate a QR code however you like. For example, Google Chart API:
https://chart.googleapis.com/chart?cht=qr&chs=400x400&chl=otpauth%3A%2F%2Ftotp%2FGoogle%3ASampleName%3FMQ2TQNLEGMYTMOBXGY3Q%26issuer%3DGoogle%26image%3Dhttp%3A%2F%2Fgoogle.com%2Fimage%2Flogo.png
While this feature is supported by FreeOTP, other apps do not. It's not part of the spec for TOTP, although it should be.

How to expire Branch.io link within specific time? (Deep linking via branch metrics)

I am using link to generate deep linking. I am using their public API's endpoint to generate links.
Here is their endpoint: https://api.branch.io/v1/url
I append my branch key and data that I need to associate in this link. Everything is working fine but I need to expire this link within one hour.
Reading up here: https://github.com/BranchMetrics/branch-deep-linking-public-api#creating-a-deep-linking-url
I added "duration" key also, but it didnt expire the link.
It will be great if anyone could help me in figuring out how to expire branch.io link.
Alex from Branch.io here: the duration parameter is used for something different, so it's not going to be able to do what you want. We don't have a built-in feature to expire links, but you could create something close to it yourself:
Add a custom link parameter containing a timestamp for when the link was created.
Check for that timestamp when handling the link at the destination, and do something different if it is more than an hour old. I'm guessing this would be inside your app, and also on whatever fallback URL you have specified for when the app isn't installed or the user is on desktop.
Mail from branch.io support team suggested this answer as below:
If you found out about the $exp_date parameter from here then the
parameters in that list are only used for iOS Spotlight Indexing but
will be used by Branch in the future. A better solution than
utilizing $exp_date is to code logic into your client to determine
what to do with link data based on date. This way, your deep links
will always work and always carry data through, and you won't have to
worry about users clicking empty links.
This way, you would include date as an extra meta key/value pair, and
examine this date in your client when receiving link params to
determine if you want to honor the link's contents or not.

ASP.NET Youtube Channel Regex

I've seen many youtube regex here on StackOverflow and around the web but failed to find (or edit) the one I need.
What I need is to validate user input for a valid youtube url wich should also contain the Youtube page/channel.
So this is not much about Youtube direct video urls but rather to validate channels, something like:
https://www.youtube.com/user/myyoutubeusername
It would be nice if it could be used to validate even direct links to videos, youtu.be short format urls and other Youtube links by the way.
I need this in an ASP.NET regex validator control, but I guess this is secondary.
Thanks in advance.
Depends what characters you actually want to allow for "user" and "channel" but a quick solution could be:
https?:\/\/(?:www\.)?youtube\.com\/[\w-]+\/[\w-]+
In this case it allows for characters [a-zA-Z_-]. "http" protocol matches as well as "https" and "www." is optional.
To get the channel name or channel id from a youtube URL use:
(?:https|http)\:\/\/(?:[\w]+\.)?youtube\.com\/(?:c\/|channel\/|user\/)?([a-zA-Z0-9\-]{1,})
This works for URL's like:
https://www.youtube.com/user/channelblabla
https://www.youtube.com/channel/channelblabla
https://www.youtube.com/c/channelblabla
https://www.youtube.com/channelblabla
If you are looking for channel id's specifically: Channel ID's start with 'UC'. I don't know of any other way to recognize channel ID's vs. channel names.

Capturing a Map to embed in a Wordpress Blog post

I originally asked this question on Super User but was told that it might be better placed here...
I have a running blog and to help me track and write about my runs I've recently bought a Garmin GPS watch. The setup works a treat and I'm able to share links to my runs in my blog such as:
http://connect.garmin.com/activity/23842182
Is there an easy way for me to capture the map itself out of the Garmin Connect site (see the link) and display it in my blog posting? I can take a screenshot but an interactive map would be heaps better. It's obviously a Google Map with the run info overlayed so there must be a way... right?
To created an embedded interactive Google Map to render your run polylines, you will need to extract the data that the Garmin site is using to render the line.
From the Garmin site, there are two Javascript files that do the work:
http://connect.garmin.com/resource/garmin-js-lib/map/MapsUtil.js - Bunch of utility functions for rendering Google maps based on data in the Garmin system
http://connect.garmin.com/api/activity/component/mapLoader.js - Uses Garmin.service.ActivityClient to grab the JSON data describing the polyline. It feeds this data into Garmin.map.MapsUtil.addEncodedPolylineToMap to render the map.
So do do this on your blog, you will need to either request the JSON data from the Garmin site (and trust that the URI format doesn't change) or grab the data and store it on your own site. The URI format is currently:
http://connect.garmin.com/proxy/activity-service-1.0/gpolyline/activity/<activity id>?full=true
Where activity ID is the last number in your original URL. So:
http://connect.garmin.com/activity/23842182
http://connect.garmin.com/proxy/activity-service-1.0/gpolyline/activity/23842182?full=true
This data request will return some JSON that you can then use to render a Google Map.
Once you have decided how you want to store the JSON data, you will need to write some Javascript to request the JSON and, in the callback, feed it into the GPolyline.fromEncoded method. Once you have a GPolyline object (that is populated from the encoded JSON data), you can add it to a Google Maps GMap2 with the addOverlay method.
I realize that this answer is fairly technically involved and might be overwhelming if you haven't played with Google Maps before. If this is the case, I suggest heading over to the Google Maps API intro page for some hints on getting started.
Since this question was first posted, Garmin Connect has since added a quick code snippet to embed in your WordPress site to display your maps and course data. If you're having issues getting the code snippet to stay in the post after saving - check out these instructions for embedding Garmin Connect activities in WordPress.

Resources