How to get media-id from Instagram URL - instagram

how can I get the media-id of a instagram posting from the url?
For example I need the media-id for https://www.instagram.com/p/Cf4dPucLzW0/
Solutions that does not work anymore:
Oembed dont give media-id back
adding ?__a=1 to a link redirects me to the post itself

Put the following at the end of the post: ?__a=1&__d=dis, e.g.:
https://www.instagram.com/p/Cf4dPucLzW0/?__a=1&__d=dis

Related

Google couldn't fetch my sitemap.xml file

I've got a small flask site for my old wow guild and I have been unsuccessful in getting google to read my sitemap.xml file. I was able to successful verify my site using googles Search Console and it seems to crawl it just fine but when I go to submit my sitemap, it lists the status as "Couldn't fetch". When I click on that for more info all it says is "Sitemap could not be read" (not helpful)
I originally used a sitemap generator website (forgot which one) to create the file and then added it to my route file like this:
#main.route('/sitemap.xml')
def static_from_root():
return send_from_directory(app.static_folder, request.path[1:])
If I navigated to www.mysite.us/sitemap.xml it would display the expected results but google was unable to fetch it.
I then changed things around and started using flask-sitemap to generate it like this:
#ext.register_generator
def index():
yield 'main.index', {}
This also works fine when I navigate directly to the file but google again does not like this.
I'm at a loss. There doesn't seem to but any way to get help from google on this and so far my interweb searches aren't turning up anything helpful.
For reference, here is the current sitemap link: www.renewedhope.us/sitemap.xml
I finally got it figured out. This seems to go against what google was advising but I submitted the sitemap as http://renewedhope.us/sitemap.xml and that finally worked.
From their documentation:
Use consistent, fully-qualified URLs. Google will crawl your URLs
exactly as listed. For instance, if your site is at
https://www.example.com/, don't specify a URL as https://example.com/
(missing www) or ./mypage.html (a relative URL).
I think that only applies to the sitemap document itself.
When submitting the sitemap to google, I tried...
http://www.renewedhope.us/sitemap.xml
https://www.renewedhope.us/sitemap.xml
https://renewedhope.us/sitemap.xml
The only format that they were able to fetch the sitemap from was:
http://renewedhope.us/sitemap.xml
Hope this information might help someone else facing the same issue :)
put this tag in your robots.txt file Sitemap: domainname.com/sitemap.xml. Hope this will be helpful.

Issue with Discord OAuth2 redirect_uri component

I'm currently working on Discord OAuth2 client for my web application.
No matter how hard I try to set the redirect_uri to make discord not send the error, I can't get fix it, and I keep getting this message:
Invalid OAuth2 redirect_uri : You can now close this tab.
(sorry for the foreign language in the second line)
My redirect_uri is:
const redirect = encodeURIComponent("http://localhost/callback");
(the website exists on the server and works as should.)
**I tried so many combinations, including:
- adding https:// instead of http://
- adding .com to the domain
- adding a slash after the word callback
- using normal string instead of encodeURIComponent
- generating the oauth2 redirect_uri via the Discord Developer page
**
The only thing that worked was totally removing the redirect_uri from the URL parameters, which made the app work, but didn't redirect to the correct place afterward;
(This is my oauth2 url):
https://discordapp.com/api/oauth2/authorize?client_id=${id}&redirect_uri=${redirect}&response_type=code&scope=identify%20guilds%20email,
when id = client id in string type and redirect = (above) the url
Thanks for any help.
Edit 1: setting the redirect_uri intentionally to a wrong URL, sends a JSON message saying "Badly formatted redirect_uri." (not the one visible on the screenshot!)
Edit 2: example complete url: https://discordapp.com/oauth2/authorize?client_id=528972063096963140&redirect_uri=http%3A%2F%2Flocalhost%2Fdiscord%2Fcallback&response_type=code&scope=identify%20guilds%20email
I got this issue today and after debugging a while around, I found what I was doing wrong.
While I registered my application on Discord, it asked me for a redirect_uri which we need to specify so that Discord can only allow those urls to redirect from the login page. But after fiddling a while on my project I changed the redirect url from node, which didn't match with what I already specified on Discord. That's why this issue popped up for me.
Screenshot from my discord developer dashboard (change this redirect url):
Fix: Go to Discord and update your new redirect url (as per your need). And this will fix the error on the login page that you're facing. Remember to save either by pressing enter in the field or by pressing the save-button that pops up at the bottom of the page.
Hope I could help!
I know this is resolved for a long time but i'm adding this in case someone has this issue and don't know what's happening: if you are calling the https://discord.com/api/oauth2/token endpoint to resolve a code to a token, you have to make the redirect_uri field the SAME as the one that generated the code with the https://discord.com/api/oauth2/authorize endpoint, otherwise you'll get this error. It also has to be, like mentioned above, EXACTLY (querystrings don't work) the same as one of the redirects in the redirects list of your application.
When using Next-Auth, I had success setting my redirect Url in discord settings as http://localhost:3000/api/auth/callback/discord

Adding post ID to avoid URL crashing?

I am creating a website, now it's time to decide how the URL for different posts should look like.
For SEO purposes, I am planing to add the post URL, like
example.com/post.php?v=a-very-interesting-title
To prevent URL crashing, I was thinking to add the post ID to the URL, like
example.com/post.php?v=a-very-interesting-title-32
What do you think about adding the post ID to the URL, any security concerns? Should I hash the ID before adding to the URL? How should I do that?

Azure AD Logout Url - Redirect not working

I'm using Azure AD to authenticate users into a ColdFusion web application. All works great, except when I log the user out I want to redirect them back to a page in my application. The logout works correctly as far as clearing the cookies, etc, but the redirect is not happening.
I'm using the following format on my URL for logging out
https://login.microsoftonline.com/<tenant id>/oauth2/logout?&client_id=MY_CLIENT_ID&post_logout_redirect_uri=https://myredirecturl
If I do not supply a valid URI, it gives me a error message stating that 'post_logout_redirect_uri' value must be a valid absolute Uri.. So I know it's seeing the URL parameter properly, but it is just NOT redirecting.
Anyone have any suggestions?
Thank you!
A few things to try:
Try using a different browser. That could indicate a browser-specific JavaScript issue.
Try URL encoding the URL that you're redirecting to.
Make sure the URL you are redirecting to is in the same domain as your web app.
Also, I noticed your logout URL is a little funny: you have both a "?" followed by a "&" before your client_id query string parameter. I suggest you remove the "&" and have your URL look like .../oauth2/logout?client_id=...&post_logout_redirect_uri=...

Spotify Web API Redirect Issue

I have set my redirect uri to something like this:
../index.php?r=spotifycollegeplaylists/tab/index
I was able to setup the login using this example
https://github.com/jwilsson/spotify-web-api-php
The login is working fine, I can trigger the login popup and I am able to login. Now the problem is with the redirection. After logging in I am redirected to this URL:
../index.php%3Fr=spotifycollegeplaylists/tab/index&page=index?code=AQCtOWUzHM
See the problem with the redirect is that it has two "?" If i manually change %3F to ? and ?code to &code, the links is working okay.using the method from the API above how will I be able to fix this issue?
I've made a query on the Spotify Web API site as well, and I got a feedback from one of their support team / developer.
"I understand your issue and I would recommend that you don't have any query parameters in your callback URLs. We have a known issue in that we don't allow the Redirect URI to include parameters and hopefully this will be fixed soon. Meanwhile, you could use the state parameter that you'll get back when the code is returned through the callback."

Resources